From cdf2ba200edca620f49c275f81029a26da7d89eb Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 5 Mar 2023 11:57:44 -0500 Subject: [PATCH] test_runner: remove root tracking set The wasRootSetup Set in the test harness appears to be redundant, since the startTime field can be used interchangeably. This commit removes wasRootSetup. PR-URL: https://github.com/nodejs/node/pull/46961 Reviewed-By: Moshe Atlow Reviewed-By: Yagiz Nizipli --- lib/internal/test_runner/harness.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/internal/test_runner/harness.js b/lib/internal/test_runner/harness.js index 75931ff1155039..17b1e586ba861e 100644 --- a/lib/internal/test_runner/harness.js +++ b/lib/internal/test_runner/harness.js @@ -2,7 +2,6 @@ const { ArrayPrototypeForEach, SafeMap, - SafeWeakSet, } = primordials; const { createHook, @@ -25,7 +24,6 @@ const { const { bigint: hrtime } = process.hrtime; const testResources = new SafeMap(); -const wasRootSetup = new SafeWeakSet(); function createTestTree(options = kEmptyObject) { return setup(new Test({ __proto__: null, ...options, name: '' })); @@ -104,7 +102,7 @@ function collectCoverage(rootTest, coverage) { } function setup(root) { - if (wasRootSetup.has(root)) { + if (root.startTime !== null) { return root; } @@ -168,8 +166,6 @@ function setup(root) { coverage: null, }; root.startTime = hrtime(); - - wasRootSetup.add(root); return root; }