Skip to content

Commit

Permalink
Fix CLI exit code to be number of failures. Closes #10.
Browse files Browse the repository at this point in the history
  • Loading branch information
domenic committed Dec 24, 2012
1 parent ceb13ab commit a24678d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var filePath = getAdapterFilePath();
var adapter = adapterObjectFromFilePath(filePath);
programmaticRunner(adapter, function (err) {
if (err) {
throw err;
process.exit(err.failures || -1);
}
});

Expand Down
4 changes: 3 additions & 1 deletion lib/programmaticRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ module.exports = function (adapter, cb) {
mocha.run(function (failures) {
delete global.adapter;
if (failures > 0) {
cb(new Error("Test suite failed with " + failures + " failures."));
var err = new Error("Test suite failed with " + failures + " failures.");
err.failures = failures;
cb(err);
}
});
});
Expand Down

0 comments on commit a24678d

Please sign in to comment.