Skip to content

Commit

Permalink
🏗 Prevent Karma from hanging when a transformation error is encounter…
Browse files Browse the repository at this point in the history
…ed (#33967)
  • Loading branch information
rsimha authored Apr 24, 2021
1 parent d33dbca commit c0e946a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions build-system/tasks/report-test-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ async function reportAllExpectedTests() {

/**
* Callback to the Karma.Server on('run_complete') event for simple test types.
* Optionally takes an object containing test results if they were run.
*
* @param {!Karma.TestResults} results
* @param {?Karma.TestResults} results
*/
async function reportTestRunComplete(results) {
if (results.error) {
if (!results || results.error) {
await reportTestErrored();
} else {
await reportTestFinished(results.success, results.failed);
Expand Down
4 changes: 2 additions & 2 deletions build-system/tasks/runtime-test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const fs = require('fs');
const path = require('path');
const {green, yellow, cyan} = require('kleur/colors');
const {isCiBuild} = require('../../common/ci');
const {log} = require('../../common/logging');
const {log, logWithoutTimestamp} = require('../../common/logging');
const {maybePrintCoverageMessage} = require('../helpers');
const {reportTestRunComplete} = require('../report-test-status');
const {Server} = require('karma');
Expand Down Expand Up @@ -172,7 +172,7 @@ async function karmaBrowserComplete_(browser) {
* @private
*/
function karmaBrowserStart_() {
console./*OK*/ log('\n');
logWithoutTimestamp('\n');
log(green('Done. Running tests...'));
}

Expand Down
8 changes: 3 additions & 5 deletions build-system/tasks/runtime-test/runtime-test-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,11 +399,9 @@ class RuntimeTestRunner {
await stopServer();
exitCtrlcHandler(this.env.get('handlerProcess'));
if (this.exitCode != 0) {
log(
red('ERROR:'),
yellow(`Karma test failed with exit code ${this.exitCode}`)
);
process.exitCode = this.exitCode;
const message = `Karma test failed with exit code ${this.exitCode}`;
log(red('ERROR:'), yellow(message));
throw new Error(message);
}
}
}
Expand Down

0 comments on commit c0e946a

Please sign in to comment.