Skip to content

Commit ef69fad

Browse files
committed
test: cleanup WPT setup files, update WPT fixtures, update expectations
1 parent c90ea93 commit ef69fad

File tree

238 files changed

+5027
-5159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+5027
-5159
lines changed

β€Žtest/common/wpt.js

+21-34
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ class StatusRuleSet {
251251

252252
// A specification of WPT test
253253
class WPTTestSpec {
254+
255+
#content;
256+
254257
/**
255258
* @param {string} mod name of the WPT module, e.g.
256259
* 'html/webappapis/microtask-queuing'
@@ -298,7 +301,10 @@ class WPTTestSpec {
298301
}
299302

300303
getContent() {
301-
return fs.readFileSync(this.getAbsolutePath(), 'utf8');
304+
if (!this.#content) {
305+
this.#content = fs.readFileSync(this.getAbsolutePath(), 'utf8');
306+
}
307+
return this.#content;
302308
}
303309
}
304310

@@ -374,6 +380,7 @@ class StatusLoader {
374380
result.push(filepath);
375381
}
376382
}
383+
result = result.filter((filepath) => !filepath.endsWith('.helper.js'));
377384
return result;
378385
}
379386

@@ -484,9 +491,7 @@ class WPTRunner {
484491
pretendGlobalThisAs(name) {
485492
switch (name) {
486493
case 'Window': {
487-
this.globalThisInitScripts.push(
488-
`global.Window = Object.getPrototypeOf(globalThis).constructor;
489-
self.GLOBAL.isWorker = () => false;`);
494+
this.globalThisInitScripts.push('globalThis.Window = Object.getPrototypeOf(globalThis).constructor;');
490495
this.loadLazyGlobals();
491496
break;
492497
}
@@ -526,39 +531,10 @@ class WPTRunner {
526531
this.globalThisInitScripts.push(script);
527532
}
528533

529-
brandCheckGlobalScopeAttribute(name) {
530-
// TODO(legendecas): idlharness GlobalScope attribute receiver validation.
531-
const script = `
532-
const desc = Object.getOwnPropertyDescriptor(globalThis, '${name}');
533-
function getter() {
534-
// Mimic GlobalScope instance brand check.
535-
if (this !== globalThis) {
536-
throw new TypeError('Illegal invocation');
537-
}
538-
return desc.get();
539-
}
540-
Object.defineProperty(getter, 'name', { value: 'get ${name}' });
541-
542-
function setter(value) {
543-
// Mimic GlobalScope instance brand check.
544-
if (this !== globalThis) {
545-
throw new TypeError('Illegal invocation');
546-
}
547-
desc.set(value);
548-
}
549-
Object.defineProperty(setter, 'name', { value: 'set ${name}' });
550-
551-
Object.defineProperty(globalThis, '${name}', {
552-
get: getter,
553-
set: setter,
554-
});
555-
`;
556-
this.globalThisInitScripts.push(script);
557-
}
558-
559534
// TODO(joyeecheung): work with the upstream to port more tests in .html
560535
// to .js.
561536
async runJsTests() {
537+
this.pretendGlobalThisAs('Window');
562538
let queue = [];
563539

564540
// If the tests are run as `node test/wpt/test-something.js subset.any.js`,
@@ -914,6 +890,17 @@ class WPTRunner {
914890
continue;
915891
}
916892

893+
if (filename.includes('tentative')) {
894+
this.skip(filename, [ 'test makes assertions not yet required by any specification' ]);
895+
continue;
896+
}
897+
898+
const isServiceWorker = spec.getContent().includes('importScripts(');
899+
if (isServiceWorker) {
900+
this.skip(filename, [ 'importScripts is not defined' ]);
901+
continue;
902+
}
903+
917904
queue.push(spec);
918905
}
919906
return queue;

β€Žtest/fixtures/wpt/FileAPI/BlobURL/test2-manual.html

-62
This file was deleted.

β€Žtest/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html

-33
This file was deleted.

β€Žtest/fixtures/wpt/FileAPI/FileReader/support/file_test1.txt

Whitespace-only changes.

β€Žtest/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html

-72
This file was deleted.

β€Žtest/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html

-42
This file was deleted.

β€Žtest/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html

-40
This file was deleted.

β€Žtest/fixtures/wpt/FileAPI/FileReader/workers.html

-27
This file was deleted.

0 commit comments

Comments
Β (0)