Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7960ccb

Browse filesBrowse files
cjihrigtargos
authored andcommitted
test_runner: throw if harness is not bootstrapped
This commit updates the test harness to re-throw uncaught errors if bootstrapping has not completed. This updates the existing logic which tried to detect a specific error code. PR-URL: #46962 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent b832d77 commit 7960ccb
Copy full SHA for 7960ccb

File tree

Expand file treeCollapse file tree

2 files changed

+7
-15
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+7
-15
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/harness.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/harness.js
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const { exitCodes: { kGenericUserError } } = internalBinding('errors');
1818
const { kEmptyObject } = require('internal/util');
1919
const { kCancelledByParent, Test, Suite } = require('internal/test_runner/test');
2020
const {
21-
kAsyncBootstrapFailure,
2221
parseCommandLine,
2322
setupTestReporters,
2423
} = require('internal/test_runner/utils');
@@ -32,11 +31,11 @@ function createTestTree(options = kEmptyObject) {
3231

3332
function createProcessEventHandler(eventName, rootTest) {
3433
return (err) => {
35-
if (err?.failureType === kAsyncBootstrapFailure) {
34+
if (!rootTest.harness.bootstrapComplete) {
3635
// Something went wrong during the asynchronous portion of bootstrapping
3736
// the test runner. Since the test runner is not setup properly, we can't
3837
// do anything but throw the error.
39-
throw err.cause;
38+
throw err;
4039
}
4140

4241
// Check if this error is coming from a test. If it is, fail the test.
Collapse file

‎lib/internal/test_runner/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js
+5-12Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const {
77
RegExp,
88
RegExpPrototypeExec,
99
SafeMap,
10-
Symbol,
1110
} = primordials;
1211
const { basename } = require('path');
1312
const { createWriteStream } = require('fs');
@@ -24,7 +23,6 @@ const {
2423
} = require('internal/errors');
2524
const { compose } = require('stream');
2625

27-
const kAsyncBootstrapFailure = Symbol('asyncBootstrapFailure');
2826
const kMultipleCallbackInvocations = 'multipleCallbackInvocations';
2927
const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
3028
const kSupportedFileExtensions = /\.[cm]?js$/;
@@ -151,15 +149,11 @@ async function getReportersMap(reporters, destinations) {
151149

152150

153151
async function setupTestReporters(rootTest) {
154-
try {
155-
const { reporters, destinations } = parseCommandLine();
156-
const reportersMap = await getReportersMap(reporters, destinations);
157-
for (let i = 0; i < reportersMap.length; i++) {
158-
const { reporter, destination } = reportersMap[i];
159-
compose(rootTest.reporter, reporter).pipe(destination);
160-
}
161-
} catch (err) {
162-
throw new ERR_TEST_FAILURE(err, kAsyncBootstrapFailure);
152+
const { reporters, destinations } = parseCommandLine();
153+
const reportersMap = await getReportersMap(reporters, destinations);
154+
for (let i = 0; i < reportersMap.length; i++) {
155+
const { reporter, destination } = reportersMap[i];
156+
compose(rootTest.reporter, reporter).pipe(destination);
163157
}
164158
}
165159

@@ -225,7 +219,6 @@ module.exports = {
225219
doesPathMatchFilter,
226220
isSupportedFileType,
227221
isTestFailureError,
228-
kAsyncBootstrapFailure,
229222
parseCommandLine,
230223
setupTestReporters,
231224
};

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.