Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
feature(launcher): aggregate failures at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
hankduan committed Jun 17, 2014
1 parent 8582b19 commit 4e1cfe5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,17 +191,22 @@ var reporter = {
},

reportSummary: function() {
var totalFailures = 0;
this.taskReporters_.forEach(function(taskReporter) {
var capability = taskReporter.task.capability;
var shortName = (capability.browserName) ? capability.browserName : '';
shortName += (capability.version) ? capability.version : '';
shortName += (' #' + taskReporter.task.taskId);
if (taskReporter.failedCount) {
log_(shortName + ' failed ' + taskReporter.failedCount + ' test(s)');
totalFailures += taskReporter.failedCount;
} else {
log_(shortName + ' passed');
}
});
if (this.taskReporters_.length > 1 && totalFailures) {
log_('overall: ' + totalFailures + ' failure(s)');
}
}
};

Expand Down

2 comments on commit 4e1cfe5

@nirvanagit
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update. This was required. Although the reportSummary() would not be called if their are failed test cases, as it is called in the else clause (line # 172). This way the "log_('overall: ' ....." is not called when tests are failing.

@hankduan
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for bringing this up. The difficult part about this is that the process exits with non-zero code both when spec(s) fail and when the code throws an error.
In the first case, we want to report a summary, whereas in the second place we don't (because no spec will fail, resulting in the reporter erroneously thinking that the test suite passed).

It does appear that the first case exits with code 1 while the second case exits with code 8 though. I hope that will always the case, but if not, we might need to adjust this in the future. Here's the PR to fix this: #946.

Please sign in to comment.