Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 8b728524f6a28a5e506ccdf5f7b2dba98fdd72fc
parent 7f668b99bd0c6d9a716deb0a3def16ae29ed36f1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 10 Oct 2026 14:11:18 -0400

e2e: the timing reporter records nothing for `playwright test --list`

`--list` writes a json report that names every test with no results, and the
reporter recorded it as a run (wall ~1–3 s) in the branch's history, where the
next real run is compared against it. A report in which no test ran is now
skipped like an empty one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mscripts/e2e-timings-reporter.mjs | 6+++---
Mscripts/e2e-timings.mjs | 13++++++++++++-
Mscripts/e2e-timings.test.mjs | 10++++++++++
3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/scripts/e2e-timings-reporter.mjs b/scripts/e2e-timings-reporter.mjs @@ -16,8 +16,8 @@ // its own run's json. // // It never fails a run: a report it cannot read or a history it cannot write -// is one line on stderr. A run with no tests (`--list`, a filter that matched -// nothing) records nothing. +// is one line on stderr. A run where no test ran (`--list`, whose report lists +// tests with no results, or a filter that matched nothing) records nothing. // // reporter: [["list"], ["json", { outputFile: "test-results/timings.json" }], // ["../scripts/e2e-timings-reporter.mjs", { outputFile: "test-results/timings.json" }]] @@ -51,7 +51,7 @@ export default class E2eTimingsReporter { top: this.options.top ?? 10, skipEmpty: true, }); - if (out.run.totals.tests === 0) return; + if (!out.lines.length) return; // nothing ran (`--list`, an empty filter) process.stdout.write(`\n${out.lines.join("\n")}\n${out.note ? `${out.note}\n` : ""}`); } catch (err) { process.stderr.write(`e2e-timings: not recorded (${err?.code ?? err?.message ?? err})\n`); diff --git a/scripts/e2e-timings.mjs b/scripts/e2e-timings.mjs @@ -72,6 +72,14 @@ export function summarize(report) { }; } +/** Whether any test in a Playwright JSON report has a result (it ran). */ +export function anyResults(report) { + const walk = (suite) => + (suite.specs ?? []).some((spec) => (spec.tests ?? []).some((t) => (t.results ?? []).length > 0)) || + (suite.suites ?? []).some(walk); + return (report.suites ?? []).some(walk); +} + // ------------------------------------------------------------------ history function gitOut(args, cwd) { @@ -222,7 +230,10 @@ export function recordReport(report, opts = {}) { const branch = opts.branch ?? gitOut(["rev-parse", "--abbrev-ref", "HEAD"], cwd) ?? "unknown"; const head = gitOut(["rev-parse", "HEAD"], cwd); const run = { ...summarize(json), head }; - if (opts.skipEmpty && run.totals.tests === 0) return { lines: [], note: "", recorded: false, run }; + // `--list` writes a report whose tests never ran (no results): not a run. + if (opts.skipEmpty && (run.totals.tests === 0 || !anyResults(json))) { + return { lines: [], note: "", recorded: false, run }; + } const dir = opts.historyDir ?? defaultHistoryDir(cwd); let earlier = []; let note = ""; diff --git a/scripts/e2e-timings.test.mjs b/scripts/e2e-timings.test.mjs @@ -196,6 +196,16 @@ test("recordReport records a run once; an empty run is neither recorded nor rend const empty = recordReport(file, { historyDir: hist, branch: "r23/x", skipEmpty: true }); assert.deepEqual([empty.recorded, empty.lines], [false, []]); assert.equal(readHistory(historyFile(hist, "editor", "r23/x")).length, 1); + + // `playwright test --list` writes every test with no results: nothing ran. + const listed = { + stats: { startTime: "2026-10-10T18:06:29.075Z", duration: 2914 }, + suites: [{ file: "a.spec.ts", specs: [{ title: "t", file: "a.spec.ts", tests: [{ status: "skipped", results: [] }] }] }], + }; + fs.writeFileSync(file, JSON.stringify(listed)); + const list = recordReport(file, { historyDir: hist, branch: "r23/x", skipEmpty: true }); + assert.deepEqual([list.recorded, list.lines], [false, []]); + assert.equal(readHistory(historyFile(hist, "editor", "r23/x")).length, 1); }); test("the reporter records at onExit: a full run, then a re-run of one spec, are BOTH in the history", async () => {