Skip to content

Commit 6a8249e

Browse files
committed
no console
1 parent 878cf24 commit 6a8249e

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

lib/internal/test_runner/harness.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const {
44
createHook,
55
executionAsyncId,
66
} = require('async_hooks');
7-
const console = require('console');
87
const {
98
codes: {
109
ERR_TEST_FAILURE,
@@ -22,24 +21,24 @@ function createProcessEventHandler(eventName, rootTest) {
2221
// Check if this error is coming from a test. If it is, fail the test.
2322
const test = testResources.get(executionAsyncId());
2423

25-
if (test !== undefined) {
26-
if (test.finished) {
27-
// If the test is already finished, report this as a top level
28-
// diagnostic since this is a malformed test.
29-
const msg = `Warning: Test "${test.name}" generated asynchronous ` +
30-
'activity after the test ended. This activity created the error ' +
31-
`"${err}" and would have caused the test to fail, but instead ` +
32-
`triggered an ${eventName} event.`;
33-
34-
rootTest.diagnostic(msg);
35-
return;
36-
}
37-
38-
test.fail(new ERR_TEST_FAILURE(err, eventName));
39-
test.postRun();
40-
} else {
41-
console.error(err);
24+
if (test === undefined) {
25+
throw err;
26+
}
27+
28+
if (test.finished) {
29+
// If the test is already finished, report this as a top level
30+
// diagnostic since this is a malformed test.
31+
const msg = `Warning: Test "${test.name}" generated asynchronous ` +
32+
'activity after the test ended. This activity created the error ' +
33+
`"${err}" and would have caused the test to fail, but instead ` +
34+
`triggered an ${eventName} event.`;
35+
36+
rootTest.diagnostic(msg);
37+
return;
4238
}
39+
40+
test.fail(new ERR_TEST_FAILURE(err, eventName));
41+
test.postRun();
4342
};
4443
}
4544

0 commit comments

Comments
 (0)