summaryrefslogtreecommitdiff
path: root/tools/wpt.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tools/wpt.ts')
-rwxr-xr-xtools/wpt.ts26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/wpt.ts b/tools/wpt.ts
index e7da43e64..13f8b6467 100755
--- a/tools/wpt.ts
+++ b/tools/wpt.ts
@@ -34,6 +34,10 @@ import {
red,
yellow,
} from "https://deno.land/std@0.84.0/fmt/colors.ts";
+import {
+ writeAll,
+ writeAllSync,
+} from "https://deno.land/std@0.95.0/io/util.ts";
import { saveExpectation } from "./wpt/utils.ts";
const command = Deno.args[0];
@@ -104,7 +108,7 @@ async function setup() {
throw err;
}
});
- await Deno.writeAll(
+ await writeAll(
file,
new TextEncoder().encode(
"\n\n# Configured for Web Platform Tests (Deno)\n" + entries,
@@ -150,7 +154,7 @@ async function run() {
rest.length == 0 ? undefined : rest,
expectation,
);
- assertAllExpectationsHaveTests(expectation, tests);
+ assertAllExpectationsHaveTests(expectation, tests, rest);
console.log(`Going to run ${tests.length} test files.`);
const results = await runWithTestUtil(false, async () => {
@@ -182,6 +186,7 @@ async function run() {
function assertAllExpectationsHaveTests(
expectation: Expectation,
testsToRun: TestToRun[],
+ filter?: string[],
): void {
const tests = new Set(testsToRun.map((t) => t.path));
const missingTests: string[] = [];
@@ -189,6 +194,12 @@ function assertAllExpectationsHaveTests(
function walk(parentExpectation: Expectation, parent: string) {
for (const key in parentExpectation) {
const path = `${parent}/${key}`;
+ if (
+ filter &&
+ !filter.find((filter) => path.substring(1).startsWith(filter))
+ ) {
+ continue;
+ }
const expectation = parentExpectation[key];
if (typeof expectation == "boolean" || Array.isArray(expectation)) {
if (!tests.has(path)) {
@@ -422,7 +433,7 @@ function analyzeTestResult(
function reportVariation(result: TestResult, expectation: boolean | string[]) {
if (result.status !== 0) {
console.log(`test stderr:`);
- Deno.writeAllSync(Deno.stdout, new TextEncoder().encode(result.stderr));
+ writeAllSync(Deno.stdout, new TextEncoder().encode(result.stderr));
const expectFail = expectation === false;
console.log(
@@ -508,7 +519,7 @@ function createReportTestCase(expectation: boolean | string[]) {
break;
}
- console.log(simpleMessage);
+ writeAllSync(Deno.stdout, new TextEncoder().encode(simpleMessage + "\n"));
};
}
@@ -536,7 +547,12 @@ function discoverTestsToRun(
) {
if (!path) continue;
const url = new URL(path, "http://web-platform.test:8000");
- if (!url.pathname.endsWith(".any.html")) continue;
+ if (
+ !url.pathname.endsWith(".any.html") &&
+ !url.pathname.endsWith(".window.html")
+ ) {
+ continue;
+ }
const finalPath = url.pathname + url.search;
const split = finalPath.split("/");