Skip to content

Commit 4515558

Browse files
committed
fixup! wpt
1 parent 38ac417 commit 4515558

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

test/common/wpt.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,11 @@ class WPTRunner {
591591
this.resource = new ResourceLoader(path);
592592
this.concurrency = concurrency;
593593

594-
this.flags = [];
594+
// Since we need to prepare the Web Worker APIs
595+
// in the harness that runs on all WPT workers,
596+
// we enable the API globally. This has no practical
597+
// effect on the non-web-worker tests, however.
598+
this.flags = ['--experimental-web-worker'];
595599
this.globalThisInitScripts = [];
596600
this.initScript = null;
597601

@@ -617,7 +621,7 @@ class WPTRunner {
617621
* @param {string[]} flags
618622
*/
619623
setFlags(flags) {
620-
this.flags = flags;
624+
this.flags = this.flags.concat(flags);
621625
}
622626

623627
/**

test/common/wpt/worker.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,14 @@ const { parentPort, workerData } = require('worker_threads');
1313
const { ResourceLoader } = require(workerData.wptRunner);
1414
const resource = new ResourceLoader(workerData.wptPath);
1515

16-
if ('Worker' in globalThis) {
17-
// Tests create workers with URLs the WPT server would have served them
18-
// from; map them into the fixtures directory.
19-
const RealWorker = globalThis.Worker;
20-
globalThis.Worker = class Worker extends RealWorker {
21-
constructor(url, options) {
22-
super(resource.mapServerURL(workerData.testRelativePath, url), options);
23-
}
24-
};
25-
}
16+
// Tests create workers with URLs the WPT server would have served them
17+
// from; map them into the fixtures directory.
18+
const RealWorker = globalThis.Worker;
19+
globalThis.Worker = class Worker extends RealWorker {
20+
constructor(url, options) {
21+
super(resource.mapServerURL(workerData.testRelativePath, url), options);
22+
}
23+
};
2624

2725
if (workerData.needsGc) {
2826
// See https://github.com/nodejs/node/issues/16595#issuecomment-340288680

0 commit comments

Comments
 (0)