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

Commit 8f1b447

Browse files
committed
fix(launcher): fix issue where test passes on unexpected failures
1 parent 25cf88c commit 8f1b447

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

lib/launcher.js

+21-8
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,14 @@ var init = function(configFile, additionalConfig) {
8686
break;
8787
case 'testsDone':
8888
self.reporter.testsDone(m.failedCount);
89-
if (typeof testsDoneCallback === 'function') {
90-
testsDoneCallback();
91-
}
9289
break;
9390
}
9491
});
9592

9693
this.process.on('error', function(err) {
9794
self.reporter.flush();
9895
log_('Runner Process(' + self.process.pid + ') Error: ' + err);
99-
runnerErrorCount += 1;
96+
runnerErrorCount += 1;
10097
});
10198

10299
this.process.on('exit', function(code) {
@@ -105,6 +102,10 @@ var init = function(configFile, additionalConfig) {
105102
log_('Runner Process Exited With Error Code: ' + code);
106103
runnerErrorCount += 1;
107104
}
105+
self.reporter.exitCode = code;
106+
if (typeof testsDoneCallback === 'function') {
107+
testsDoneCallback();
108+
}
108109
log_(scheduler.countActiveTasks() +
109110
' instance(s) of WebDriver still running');
110111
});
@@ -195,21 +196,32 @@ var reporter = {
195196
},
196197

197198
reportSummary: function() {
198-
var totalFailures = 0;
199+
var specFailures = 0;
200+
var processFailures = 0;
199201
this.taskReporters_.forEach(function(taskReporter) {
200202
var capability = taskReporter.task.capability;
201203
var shortName = (capability.browserName) ? capability.browserName : '';
202204
shortName += (capability.version) ? capability.version : '';
203205
shortName += (' #' + taskReporter.task.taskId);
204206
if (taskReporter.failedCount) {
205207
log_(shortName + ' failed ' + taskReporter.failedCount + ' test(s)');
206-
totalFailures += taskReporter.failedCount;
208+
specFailures += taskReporter.failedCount;
209+
} else if (taskReporter.exitCode != 0) {
210+
log_(shortName + ' failed with exit code: ' + taskReporter.exitCode);
211+
processFailures += 1;
207212
} else {
208213
log_(shortName + ' passed');
209214
}
210215
});
211-
if (this.taskReporters_.length > 1 && totalFailures) {
212-
log_('overall: ' + totalFailures + ' failure(s)');
216+
if (this.taskReporters_.length > 1) {
217+
if (specFailures && processFailures) {
218+
log_('overall: ' + specFailures + ' failed spec(s) and ' +
219+
processFailures + ' process(es) failed to complete');
220+
} else if (specFailures) {
221+
log_('overall: ' + specFailures + ' failed spec(s)');
222+
} else if (processFailures) {
223+
log_('overall: ' + processFailures + ' process(es) failed to complete');
224+
}
213225
}
214226
}
215227
};
@@ -226,6 +238,7 @@ var TaskReporter_ = function(task, pid) {
226238
this.pid = pid;
227239
this.failedCount = 0;
228240
this.buffer = '';
241+
this.exitCode = -1;
229242
this.insertTag = true;
230243
};
231244

0 commit comments

Comments
 (0)