diff --git a/gulpfile.js b/gulpfile.js index 9aa22351..3774d3f7 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -34,6 +34,8 @@ gulp.task('static', function () { }); gulp.task('test', function (cb) { + var mochaErr; + gulp.src([ 'lib/**/*.js', 'index.js' @@ -48,8 +50,13 @@ gulp.task('test', function (cb) { .pipe(mocha({ reporter: 'spec' })) + .on('error', function (err) { + mochaErr = err; + }) .pipe(istanbul.writeReports()) - .on('end', cb); + .on('end', function () { + cb(mochaErr); + }); }); });