Skip to content

Commit b832d77

Browse 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

3 files changed

Lines changed: 13 additions & 9 deletions

File tree

‎lib/internal/test_runner/harness.js‎

Lines 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
returnglobalRoot;
184184
}
185185

186186
asyncfunctionstartSubtest(subtest){
187187
awaitreportersSetup;
188+
getGlobalRoot().harness.bootstrapComplete=true;
188189
awaitsubtest.start();
189190
}
190191

‎lib/internal/test_runner/runner.js‎

Lines 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-
construnFiles=()=>SafePromiseAllSettledReturnVoid(testFiles,(path)=>{
391-
constsubtest=runTestFile(path,root,inspectPort,filesWatcher);
392-
runningSubtests.set(path,subtest);
393-
returnsubtest;
394-
});
390+
construnFiles=()=>{
391+
root.harness.bootstrapComplete=true;
392+
returnSafePromiseAllSettledReturnVoid(testFiles,(path)=>{
393+
constsubtest=runTestFile(path,root,inspectPort,filesWatcher);
394+
runningSubtests.set(path,subtest);
395+
returnsubtest;
396+
});
397+
};
395398

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

398401
returnroot.reporter;
399402
}

‎lib/internal/test_runner/utils.js‎

Lines 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-
asyncfunctionsetupTestReporters(testsStream){
153+
asyncfunctionsetupTestReporters(rootTest){
154154
try{
155155
const{ reporters, destinations }=parseCommandLine();
156156
constreportersMap=awaitgetReportersMap(reporters,destinations);
157157
for(leti=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
thrownewERR_TEST_FAILURE(err,kAsyncBootstrapFailure);

0 commit comments

Comments
 (0)