For some reason, I just can't seem to get gulp-mocha
to properly catch errors in my code. This issue is causing my gulp watch
task to abruptly end whenever a test fails.
My setup is incredibly basic:
gulp.task("watch", ["build"], function () {
gulp.watch([paths.scripts, paths.tests], ["test"]);
});
gulp.task("test", function() {
return gulp.src(paths.tests)
.pipe(mocha({ reporter: "spec" }).on("error", gutil.log));
});
I also tried applying the error handler to the entire stream, but encountered the same problem:
gulp.task("test", function() {
return gulp.src(paths.tests)
.pipe(mocha({ reporter: "spec" }))
.on("error", gutil.log);
});
Despite experimenting with plumber
, combine
, and gulp-batch
, I am still unable to resolve this issue. It seems like I must be missing something very obvious.