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

Commit

Permalink
fix(launcher): fix issue where test passes on unexpected failures
Browse files Browse the repository at this point in the history
  • Loading branch information
hankduan committed Aug 20, 2014
1 parent 25cf88c commit 8f1b447
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,14 @@ var init = function(configFile, additionalConfig) {
break;
case 'testsDone':
self.reporter.testsDone(m.failedCount);
if (typeof testsDoneCallback === 'function') {
testsDoneCallback();
}
break;
}
});

this.process.on('error', function(err) {
self.reporter.flush();
log_('Runner Process(' + self.process.pid + ') Error: ' + err);
runnerErrorCount += 1;
runnerErrorCount += 1;
});

this.process.on('exit', function(code) {
Expand All @@ -105,6 +102,10 @@ var init = function(configFile, additionalConfig) {
log_('Runner Process Exited With Error Code: ' + code);
runnerErrorCount += 1;
}
self.reporter.exitCode = code;
if (typeof testsDoneCallback === 'function') {
testsDoneCallback();
}
log_(scheduler.countActiveTasks() +
' instance(s) of WebDriver still running');
});
Expand Down Expand Up @@ -195,21 +196,32 @@ var reporter = {
},

reportSummary: function() {
var totalFailures = 0;
var specFailures = 0;
var processFailures = 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;
specFailures += taskReporter.failedCount;
} else if (taskReporter.exitCode != 0) {
log_(shortName + ' failed with exit code: ' + taskReporter.exitCode);
processFailures += 1;
} else {
log_(shortName + ' passed');
}
});
if (this.taskReporters_.length > 1 && totalFailures) {
log_('overall: ' + totalFailures + ' failure(s)');
if (this.taskReporters_.length > 1) {
if (specFailures && processFailures) {
log_('overall: ' + specFailures + ' failed spec(s) and ' +
processFailures + ' process(es) failed to complete');
} else if (specFailures) {
log_('overall: ' + specFailures + ' failed spec(s)');
} else if (processFailures) {
log_('overall: ' + processFailures + ' process(es) failed to complete');
}
}
}
};
Expand All @@ -226,6 +238,7 @@ var TaskReporter_ = function(task, pid) {
this.pid = pid;
this.failedCount = 0;
this.buffer = '';
this.exitCode = -1;
this.insertTag = true;
};

Expand Down

0 comments on commit 8f1b447

Please sign in to comment.