Skip to content

Commit a7621d9

Browse files
cjihriganonrig
authored andcommitted
test_runner: don't await the same promise for each test
Prior to this commit, each top level test awaited the same global promise for setting up test reporters. This commit updates the logic to only await the promise the first time it is encountered. PR-URL: nodejs#52185 Refs: nodejs#47164 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Chemi Atlow <[email protected]>
1 parent 1e458e0 commit a7621d9

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/internal/test_runner/harness.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,11 @@ function getGlobalRoot() {
225225
}
226226

227227
async function startSubtest(subtest) {
228-
await reportersSetup;
228+
if (reportersSetup) {
229+
// Only incur the overhead of awaiting the Promise once.
230+
await reportersSetup;
231+
reportersSetup = undefined;
232+
}
229233

230234
const root = getGlobalRoot();
231235
if (!root.harness.bootstrapComplete) {

0 commit comments

Comments
 (0)