File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 /**
Original file line number Diff line number Diff line change @@ -13,16 +13,14 @@ const { parentPort, workerData } = require('worker_threads');
1313const { ResourceLoader } = require ( workerData . wptRunner ) ;
1414const 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
2725if ( workerData . needsGc ) {
2826 // See https://github.com/nodejs/node/issues/16595#issuecomment-340288680
You can’t perform that action at this time.
0 commit comments