From d4c3e3b496e6c668e0f2b55a69ef7a24fffe9413 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 168310ff3d9..26f5a6ef491 100644 --- a/lib/internal/test_runner/harness.js +++ b/lib/internal/test_runner/harness.js @@ -3,7 +3,6 @@ const { ArrayPrototypeForEach, PromiseResolve, 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: '' })); @@ -108,7 +106,7 @@ function collectCoverage(rootTest, coverage) { } function setup(root) { - if (wasRootSetup.has(root)) { + if (root.startTime !== null) { return root; } @@ -172,8 +170,6 @@ function setup(root) { coverage: null, }; root.startTime = hrtime(); - - wasRootSetup.add(root); return root; }