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 <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
  • Loading branch information
cjihrig authored and rdw-msft committed Mar 26, 2024
1 parent ab08a39 commit 57d1301
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 57d1301

Please sign in to comment.