'use strict';

var path = require('path');
var gulp = require('gulp');

var karma = require('karma');

function runTests(singleRun, done) {
  karma.server.start({
    configFile: path.join(__dirname, '/../karma.conf.js'),
    singleRun: singleRun,
    autoWatch: !singleRun
  }, function(failCount) {
    done(failCount ? new Error('Failed ' + failCount + ' tests.') : null);
  });
}

gulp.task('test', ['scripts:test'], function(done) {
  runTests(true, done);
});

gulp.task('test:auto', ['scripts:test-watch'], function(done) {
  runTests(false, done);
});

@@ -139,26 +139,37 @@
 %7B%0A  
+var server = new 
 karma.
-s
+S
 erver
-.start
 (%7B%0A 
@@ -386,16 +386,34 @@
 ;%0A  %7D);%0A
+  server.start();%0A
 %7D%0A%0Agulp.

Use karma.Server instead of karma.server