summaryrefslogtreecommitdiff
path: root/tools/wpt.ts
diff options
context:
space:
mode:
authorLuca Casonato <lucacasonato@yahoo.com>2021-06-03 01:12:28 +0200
committerGitHub <noreply@github.com>2021-06-03 01:12:28 +0200
commitb2a4c2e4f650f84a4f22c655a6b504b00fe0f72f (patch)
tree6e2a3dc4629533198c3e3a41e9e1b1fea52c9d75 /tools/wpt.ts
parentb4ae243da8846d7ba0a5dd63942f90c857b744ca (diff)
build: collect wpt results as json (#10823)
Diffstat (limited to 'tools/wpt.ts')
-rwxr-xr-xtools/wpt.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/wpt.ts b/tools/wpt.ts
index 13f8b6467..203b198d1 100755
--- a/tools/wpt.ts
+++ b/tools/wpt.ts
@@ -165,7 +165,7 @@ async function run() {
const result = await runSingleTest(
test.url,
test.options,
- json ? () => {} : createReportTestCase(test.expectation),
+ createReportTestCase(test.expectation),
);
results.push({ test, result });
reportVariation(result, test.expectation);
@@ -175,7 +175,21 @@ async function run() {
});
if (json) {
- await Deno.writeTextFile(json, JSON.stringify(results));
+ const minifiedResults = [];
+ for (const result of results) {
+ const minified = {
+ file: result.test.path,
+ name:
+ Object.fromEntries(result.test.options.script_metadata ?? []).title ??
+ null,
+ cases: result.result.cases.map((case_) => ({
+ name: case_.name,
+ passed: case_.passed,
+ })),
+ };
+ minifiedResults.push(minified);
+ }
+ await Deno.writeTextFile(json, JSON.stringify(minifiedResults));
}
const code = reportFinal(results);
Deno.exit(code);