Skip to content

Commit

Permalink
added non-zero exit code when tests failed / there were errors
Browse files Browse the repository at this point in the history
  • Loading branch information
beatfactor committed Mar 21, 2014
1 parent e4fb7e3 commit da46284
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion runner/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ module.exports = new (function() {
}
}

function processExitListener() {
process.on('exit', function(code) {
if (globalResults.errors > 0 || globalResults.failed > 0) {
process.exit(1);
} else {
process.exit(code);
}
});
}

function wrapTest(setUp, tearDown, fn, context, onComplete, client) {
return function (c) {
context.client = c;
Expand Down Expand Up @@ -300,7 +310,7 @@ module.exports = new (function() {
console.log('using source folder', paths);
return;
}

var module;
var modulePath = fullpaths.shift();
try {
Expand Down Expand Up @@ -359,6 +369,8 @@ module.exports = new (function() {
}
}, finishCallback);
}, opts);

processExitListener();
};
})();

0 comments on commit da46284

Please sign in to comment.