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: #52185
Refs: #47164
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
  • Loading branch information
cjihrig authored and marco-ippolito committed May 2, 2024
1 parent 96bbd51 commit f6585f4
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 f6585f4

Please sign in to comment.