From b2a4c2e4f650f84a4f22c655a6b504b00fe0f72f Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Thu, 3 Jun 2021 01:12:28 +0200 Subject: build: collect wpt results as json (#10823) --- tools/wpt.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tools/wpt.ts') 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); -- cgit v1.2.3