Skip to content

Instantly share code, notes, and snippets.

@floatdrop
Last active May 9, 2019 15:18
Show Gist options
  • Save floatdrop/8246513 to your computer and use it in GitHub Desktop.
Save floatdrop/8246513 to your computer and use it in GitHub Desktop.
gulp.watch - run mocha tests on every file changed
// npm i gulp gulp-watch gulp-mocha gulp-batch
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var batch = require('gulp-batch');
gulp.watch(['test/**', 'lib/**'], batch(function (events, cb) {
return gulp.src(['test/*.js'])
.pipe(mocha({ reporter: 'list' }))
.on('error', function (err) {
console.log(err.stack);
});
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment