Read the runner's last summary and NOT REACHED in any case (issue 693, review 253)
mesh/merge-gate head 5ba88c69fa80 merged into trunk f9be71b9ad44 — pass: the change touches no module of the mesh's graph
mesh/repo-check head 5ba88c69fa80 merged into trunk f9be71b9ad44 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
mesh/delivery-group group fix/693-a-run-that-proved-nothing-is-not-passed delivered: every member is delivered

A test that printed a summary-shaped line before it skipped was read as the
runner's totals: "ℹ pass 5" made a run that proved nothing pass.
This commit is contained in:
jochen
2026-10-14 03:28:14 +02:00
parent 8635560993
commit 5ba88c69fa
3 changed files with 46 additions and 6 deletions
+9 -5
View File
@@ -28,14 +28,18 @@ export function counted(output: string): { passed: number | null; failed: number
// running this against the real runner — the fixture it was first written against was output I
// had imagined, which is a test that agrees with the mistake it was written beside.
const plain = output.replace(/\u001b\[[0-9;]*m/g, "");
// **The last such line, never the first** (novox/hq issue 693): the runner prints its summary after
// everything a test printed, so a test that prints "ℹ pass 5" before it skips would otherwise be read
// as five passes, and a run that proved nothing as passed.
const total = (what: RegExp) => {
const found = plain.match(what);
return found ? Number(found[1]) : null;
const found = [...plain.matchAll(what)];
const last = found[found.length - 1];
return last ? Number(last[1]) : null;
};
return {
passed: total(/^\s*(?:\u2139|#)\s*pass\s+(\d+)\s*$/m),
failed: total(/^\s*(?:\u2139|#)\s*fail\s+(\d+)\s*$/m),
skipped: total(/^\s*(?:\u2139|#)\s*skipped\s+(\d+)\s*$/m),
passed: total(/^\s*(?:\u2139|#)\s*pass\s+(\d+)\s*$/gm),
failed: total(/^\s*(?:\u2139|#)\s*fail\s+(\d+)\s*$/gm),
skipped: total(/^\s*(?:\u2139|#)\s*skipped\s+(\d+)\s*$/gm),
};
}