module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> v<%= pkg.version %> */\n',
        mangle: true
      },
      build: {
        src: 'build/smallmouth.js',
        dest: 'build/smallmouth.min.js'
      }
    },

    typescript: {
      base: {
        src: ['src/**/*.ts'],
        dest: 'build/smallmouth.js',
        options: {
          module: 'amd', //or commonjs
          target: 'es5', //or es3
          sourcemap: true,
          declaration: true,
        }
      }
    },

    karma: {
      unit: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome']
      },
      headless: {
        configFile: 'karma.conf.js',
        browsers: ['PhantomJS']
      }
    }
  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-typescript');
  grunt.loadNpmTasks('grunt-karma');

  // Default task(s).
  grunt.registerTask('default', ['typescript', 'uglify']);

};

@@ -1099,13 +1099,77 @@
 lify'%5D);
+%0A  grunt.registerTask('test', %5B'typescript', 'karma:headless'%5D);
 %0A%0A%7D;%0A

Add a new grunt task chaining build and headless testing