Skip to content

Instantly share code, notes, and snippets.

@bendangelo
Last active November 15, 2015 00:15
Show Gist options
  • Select an option

  • Save bendangelo/8c83911268902bf85f0c to your computer and use it in GitHub Desktop.

Select an option

Save bendangelo/8c83911268902bf85f0c to your computer and use it in GitHub Desktop.
Karma Gulp Task. Karma version 1.3
/**
* Run test once and exit
*/
gulp.task('test', function (done) {
var karmaServer = new karma.Server({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true
}, function (exitCode) {
done();
process.exit(exitCode);
}).start();
});
/**
* Run tests in chrome browser
*/
gulp.task('test:chrome', function (done) {
var karmaServer = new karma.Server({
configFile: __dirname + '/test/karma.conf.js',
browsers: ['Chrome']
}, function (exitCode) {
done();
process.exit(exitCode);
}).start();
});
/**
* Watch for file changes and re-run tests on each change
*/
gulp.task('tdd', function (done) {
var karmaServer = new karma.Server({
configFile: __dirname + '/test/karma.conf.js'
}, function () {
done();
}).start();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment