I am using gulp -mocha with gulp and I am trying to get notified when mocha tests are completed.
This is my gulpfile.js
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var notify = require("gulp-notify");
gulp.task('test', function () {
return gulp.src(['test/**/*.js'], { read: false })
.pipe( mocha({ reporter: 'nyan' }))
.on("error", notify.onError({
message: 'Error: <%= error.message %>'
}))
.on('end', function () {
notify( "Tests passed" )
});
});
gulp.task('watch-test', function () {
gulp.watch(['./**'], ['test']);
});
gulp.task( 'default', [ 'test', 'watch-test'] );
I was able to see the notification of the "error" event, but I could not find a way to get the "end" event.
Any idea on how to get it?
source
share