fix(testrunner): return correct exit code (#474)

This commit is contained in:
Andrey Lushnikov 2020-01-13 15:30:16 -08:00 committed by GitHub
parent 61ca679cd9
commit 98bf9ac1d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View file

@ -121,6 +121,6 @@ new Reporter(testRunner, {
// await utils.initializeFlakinessDashboardIfNeeded(testRunner); // await utils.initializeFlakinessDashboardIfNeeded(testRunner);
testRunner.run().then(result => { testRunner.run().then(result => {
process.exit(result.terminationError ? 130 : 0); process.exit(result.exitCode);
}); });

View file

@ -399,10 +399,17 @@ class TestRunner extends EventEmitter {
const result = {}; const result = {};
if (termination) { if (termination) {
result.result = termination.result; result.result = termination.result;
result.exitCode = 130;
result.terminationMessage = termination.message; result.terminationMessage = termination.message;
result.terminationError = termination.error; result.terminationError = termination.error;
} else { } else {
result.result = this.failedTests().length ? TestResult.Failed : TestResult.Ok; if (this.failedTests().length) {
result.result = TestResult.Failed;
result.exitCode = 1;
} else {
result.result = TestResult.Ok;
result.exitCode = 0;
}
} }
this.emit(TestRunner.Events.Finished, result); this.emit(TestRunner.Events.Finished, result);
if (session) if (session)