From 32a907abdc0fb50d7481421b8b833b98c4a1fd96 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sat, 25 Feb 2023 16:56:42 +0100 Subject: [PATCH] test: isolate hr-time specific wpt global init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/46795 Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso --- test/common/wpt.js | 4 +--- test/wpt/test-hr-time.js | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/common/wpt.js b/test/common/wpt.js index 1978b266c045f7..085df82befeddc 100644 --- a/test/common/wpt.js +++ b/test/common/wpt.js @@ -484,9 +484,7 @@ class WPTRunner { pretendGlobalThisAs(name) { switch (name) { case 'Window': { - this.globalThisInitScripts.push( - `global.Window = Object.getPrototypeOf(globalThis).constructor; - self.GLOBAL.isWorker = () => false;`); + this.globalThisInitScripts.push('globalThis.Window = Object.getPrototypeOf(globalThis).constructor;'); this.loadLazyGlobals(); break; } diff --git a/test/wpt/test-hr-time.js b/test/wpt/test-hr-time.js index f9dc5f0bc3211d..9b7e8fbb2afa1e 100644 --- a/test/wpt/test-hr-time.js +++ b/test/wpt/test-hr-time.js @@ -5,6 +5,9 @@ const { WPTRunner } = require('../common/wpt'); const runner = new WPTRunner('hr-time'); +runner.setInitScript(` + self.GLOBAL.isWorker = () => false; +`); runner.pretendGlobalThisAs('Window'); runner.runJsTests();