Skip to content

Commit

Permalink
test_runner: don't await the same promise for each test
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
cjihrig authored and anonrig committed Mar 25, 2024
1 parent 1e458e0 commit a7621d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/internal/test_runner/harness.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ function getGlobalRoot() {
}

async function startSubtest(subtest) {
await reportersSetup;
if (reportersSetup) {
// Only incur the overhead of awaiting the Promise once.
await reportersSetup;
reportersSetup = undefined;
}

const root = getGlobalRoot();
if (!root.harness.bootstrapComplete) {
Expand Down

0 comments on commit a7621d9

Please sign in to comment.