Skip to content

Instantly share code, notes, and snippets.

@noahmiller
Created May 14, 2014 17:02
Show Gist options
  • Save noahmiller/d61f2b61777acf32f402 to your computer and use it in GitHub Desktop.
Save noahmiller/d61f2b61777acf32f402 to your computer and use it in GitHub Desktop.
Sample gulpfile calling Karma
var gulp = require('gulp');
var path = require('path');
var karma = require('karma').server;
/**
* Run the Karma server once with the given config file path.
*/
function runKarma(configFile, cb) {
karma.start({
configFile: path.resolve(configFile),
singleRun: true
}, cb);
}
gulp.task('test', function(cb) {
runKarma('karma.conf.js', cb);
});
gulp.task('watch', function() {
gulp.watch('test/*.js', ['test']);
});
gulp.task('default', ['test', 'watch']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment