Carisenda

Karma Test Run as a Gulp Task

Below is a gulp task for running unit tests through Karma. Using the run_complete event gives more realistic timings in gulp logs then the example given at karma-runner/gulp-karma.

 gulp.task('karma', function(done) {
   var server = new Server({
     configFile: __dirname + '/karma.conf.js',
     singleRun: true
   });

   server.on('run_complete', function() {
     done();
   });
   server.start();
 });