Skip to content

Commit 4648c83

Browse files
cjihrignodejs-github-bot
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: #52185 Refs: #47164 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent 5905596 commit 4648c83

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/internal/test_runner/harness.js

+5-1
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)