diff options
author | Luca Casonato <lucacasonato@yahoo.com> | 2021-06-06 18:08:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 18:08:50 +0200 |
commit | f1deed41e7cc04440a5fb8cdae486ae00513a361 (patch) | |
tree | e8f6e0aa24e490bee09194f31e2dac8c22867612 /tools/wpt/runner.ts | |
parent | 5bd77f29e5d07af10fe9a24062c3b5b4bb79f4bf (diff) |
tests: generate and upload wptreport.json (#10869)
These reports can be consumed by tools like `wptreport` or
https://wpt.fyi. The old style report could be removed in a future PR
when wpt.deno.land is updated.
Diffstat (limited to 'tools/wpt/runner.ts')
-rw-r--r-- | tools/wpt/runner.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/wpt/runner.ts b/tools/wpt/runner.ts index a0941b521..dcc88a123 100644 --- a/tools/wpt/runner.ts +++ b/tools/wpt/runner.ts @@ -47,10 +47,18 @@ export async function runWithTestUtil<T>( export interface TestResult { cases: TestCaseResult[]; + harnessStatus: TestHarnessStatus | null; + duration: number; status: number; stderr: string; } +export interface TestHarnessStatus { + status: number; + message: string | null; + stack: string | null; +} + export interface TestCaseResult { name: string; passed: boolean; @@ -71,6 +79,8 @@ export async function runSingleTest( }); await Deno.writeTextFile(tempFile, bundle); + const startTime = new Date().getTime(); + const proc = Deno.run({ cmd: [ join(ROOT_PATH, `./target/${release ? "release" : "debug"}/deno`), @@ -94,6 +104,8 @@ export async function runSingleTest( const cases = []; let stderr = ""; + let harnessStatus = null; + const lines = readLines(proc.stderr); for await (const line of lines) { if (line.startsWith("{")) { @@ -101,15 +113,21 @@ export async function runSingleTest( const result = { ...data, passed: data.status == 0 }; cases.push(result); reporter(result); + } else if (line.startsWith("#$#$#{")) { + harnessStatus = JSON.parse(line.slice(5)); } else { stderr += line + "\n"; console.error(stderr); } } + const duration = new Date().getTime() - startTime; + const { code } = await proc.status(); return { status: code, + harnessStatus, + duration, cases, stderr, }; |