Skip to content

Commit

Permalink
test: isolate hr-time specific wpt global init
Browse files Browse the repository at this point in the history
PR-URL: #46795
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
panva authored and targos committed Mar 13, 2023
1 parent 3daf508 commit 76a9634
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions test/wpt/test-hr-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

0 comments on commit 76a9634

Please sign in to comment.