Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
#450 Use the error reported by mocha. Added some comments explaining
Browse files Browse the repository at this point in the history
what's going on in the mocha task.
  • Loading branch information
reblace committed Mar 6, 2015
1 parent 5f57f9d commit ffde5e8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,21 @@ gulp.task('less', function () {
gulp.task('mocha', function (done) {
// Open mongoose connections
var mongoose = require('./config/lib/mongoose.js');

var error;

// Connect mongoose
mongoose.connect(function() {

// Run the tests
gulp.src(testAssets.tests.server)
.pipe(plugins.mocha({
reporter: 'spec'
}))
.on('error', function (err) {
error = new Error('Mocha tests failed');
// If an error occurs, save it
error = err;
}).on('end', function() {
// When the tests are done, disconnect mongoose and pass the error state back to gulp
mongoose.disconnect(function(){
done(error);
});
Expand Down

0 comments on commit ffde5e8

Please sign in to comment.