Skip to content

Commit

Permalink
make sure we only output on exit, if there's a failure
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jun 14, 2010
1 parent 98418c7 commit 29161c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function addVow(vow) {
// If not, report an error message.
//
process.addListener('exit', function () {
var results = { honored: 0, broken: 0, errored: 0, pending: 0, total: 0 };
var results = { honored: 0, broken: 0, errored: 0, pending: 0, total: 0 }, failure;

vows.suites.forEach(function (s) {
if ((s.results.total > 0) && (s.results.time === null)) {
Expand All @@ -138,14 +138,15 @@ process.addListener('exit', function () {
}
s.batches.forEach(function (b) {
if (b.status !== 'end') {
failure = true;
results.errored ++;
results.total ++;
vows.reporter.report(['error', { error: "A callback hasn't fired", batch: b, suite: s }]);
}
Object.keys(results).forEach(function (k) { results[k] += b[k] });
});
});
if (results.total) {
if (failure) {
sys.puts(console.result(results));
}
});
Expand Down

0 comments on commit 29161c7

Please sign in to comment.