I have a standard gulp test watcher and runner for my Node.js/mocha setup;
gulp.task('mocha', function() {
process.env.NODE_ENV = 'test';
return gulp.src(['./test/**/*.js'], {read: false})
.pipe(mocha({
recursive: true,
reporter: 'list',
ui: 'bdd'
})).on('error', gutil.log);
});
gulp.task('tests', function() {
gulp.watch(sources.concat(tests), ['mocha']);
});
I'm wondering how to adapt my watch task (and the other) to only send to mocha the test that has changed - so that I don't have to wait 20 seconds for a hundred tests to run.
I've tried this with fgulp-newer and gulp-cached, but no luck.
I'm looking here for an answer or for a pseudo-algorithm for a gulp plugin I could then write for this purpose :)
You can use in your mocha test it.only()
to run only one test
describe.only()
is available too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With