1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-03 04:48:52 -05:00

build: collect wpt results as json (#10823)

This commit is contained in:
Luca Casonato 2021-06-03 01:12:28 +02:00 committed by GitHub
parent b4ae243da8
commit b2a4c2e4f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 4 deletions

View file

@ -316,7 +316,19 @@ jobs:
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test' && matrix.profile == 'release'
run: |
deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts setup
deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet --release
deno run --unstable --allow-write --allow-read --allow-net --allow-env --allow-run ./tools/wpt.ts run --quiet --release --json=wpt.json
- name: Upload wpt results to dl.deno.land
if: |
runner.os == 'Linux' &&
matrix.kind == 'test' &&
matrix.profile == 'release' &&
github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/main'
run: |
gsutil cp ./wpt.json gs://dl.deno.land/wpt/$(git rev-parse HEAD).json
echo $(git rev-parse HEAD) > wpt-latest.txt
gsutil cp wpt-latest.txt gs://dl.deno.land/wpt-latest.txt
- name: Run web platform tests (debug)
if: startsWith(matrix.os, 'ubuntu') && matrix.kind == 'test' && matrix.profile == 'debug'

View file

@ -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);

View file

@ -38,7 +38,8 @@ export type ManifestTestVariation = [
options: ManifestTestOptions,
];
export interface ManifestTestOptions {
name?: string;
// deno-lint-ignore camelcase
script_metadata: [string, string][];
}
const MANIFEST_PATH = join(ROOT_PATH, "./tools/wpt/manifest.json");