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 b832d77

Browse filesBrowse files
cjihrigtargos
authored andcommitted
test_runner: track bootstrapping process
This commit updates the test harness and root test to track when bootstrapping has completed. PR-URL: #46962 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
1 parent 05614f8 commit b832d77
Copy full SHA for b832d77

File tree

Expand file treeCollapse file tree

3 files changed

+13
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+13
-9
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-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,14 @@ function getGlobalRoot() {
178178
globalRoot.reporter.once('test:fail', () => {
179179
process.exitCode = kGenericUserError;
180180
});
181-
reportersSetup = setupTestReporters(globalRoot.reporter);
181+
reportersSetup = setupTestReporters(globalRoot);
182182
}
183183
return globalRoot;
184184
}
185185

186186
async function startSubtest(subtest) {
187187
await reportersSetup;
188+
getGlobalRoot().harness.bootstrapComplete = true;
188189
await subtest.start();
189190
}
190191

Collapse file

‎lib/internal/test_runner/runner.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/runner.js
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,13 +387,16 @@ function run(options) {
387387
filesWatcher = watchFiles(testFiles, root, inspectPort);
388388
postRun = undefined;
389389
}
390-
const runFiles = () => SafePromiseAllSettledReturnVoid(testFiles, (path) => {
391-
const subtest = runTestFile(path, root, inspectPort, filesWatcher);
392-
runningSubtests.set(path, subtest);
393-
return subtest;
394-
});
390+
const runFiles = () => {
391+
root.harness.bootstrapComplete = true;
392+
return SafePromiseAllSettledReturnVoid(testFiles, (path) => {
393+
const subtest = runTestFile(path, root, inspectPort, filesWatcher);
394+
runningSubtests.set(path, subtest);
395+
return subtest;
396+
});
397+
};
395398

396-
PromisePrototypeThen(PromisePrototypeThen(PromiseResolve(setup?.(root.reporter)), runFiles), postRun);
399+
PromisePrototypeThen(PromisePrototypeThen(PromiseResolve(setup?.(root)), runFiles), postRun);
397400

398401
return root.reporter;
399402
}
Collapse file

‎lib/internal/test_runner/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/utils.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ async function getReportersMap(reporters, destinations) {
150150
}
151151

152152

153-
async function setupTestReporters(testsStream) {
153+
async function setupTestReporters(rootTest) {
154154
try {
155155
const { reporters, destinations } = parseCommandLine();
156156
const reportersMap = await getReportersMap(reporters, destinations);
157157
for (let i = 0; i < reportersMap.length; i++) {
158158
const { reporter, destination } = reportersMap[i];
159-
compose(testsStream, reporter).pipe(destination);
159+
compose(rootTest.reporter, reporter).pipe(destination);
160160
}
161161
} catch (err) {
162162
throw new ERR_TEST_FAILURE(err, kAsyncBootstrapFailure);

0 commit comments

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