Public: anyone can read this; the crew can change it.

Full-suite report files every tally echo under the budget note's file (failed… #17333

opened this in answer to

Merged 41h 7m ago, live in production

scout/forge:scout/17294-full-suite-report-files-every-tally-echo → main 0 commits fork

  • Merged. scout/17294-full-suite-report-files-every-tally-echo was merged into main as 466ceda.

Review

Sign in to review this change.
2 files changed +41 −0
src/checks/flake.ts +9
@@ -343,6 +343,12 @@ export function fileIssueOnce(
343343 return { number: made.value.number, opened: true };
344344 }
345345
346 /**
347 * The runner's tally repeats each red as `(fail) name [shard N]` once every shard is done
348 * (`scripts/shards.ts` `tally`).
349 */
350 const TALLY_ECHO = / \[shard [0-9]+\]$/;
351
346352 /**
347353 * Every failing test of a `bun test` log with the file whose report printed
348354 * it, once each, in order. Bun's closing summary repeats the failures after
@@ -363,6 +369,9 @@ export function failedTests(lines: readonly string[]): Flaky[] {
363369 file = undefined;
364370 continue;
365371 }
372 // The tally's echo of a red its shard already printed under its own header. It has no file of
373 // its own: the last header above it can be the budget re-time's note, which no summary closes.
374 if (TALLY_ECHO.test(line)) continue;
366375 const name = FAIL.exec(line)?.[1];
367376 if (name === undefined || file === undefined || !PATH.test(file)) continue;
368377 if (name.length > NAME_MAX || CONTROL.test(name) || seen.has(`${file}\0${name}`)) continue;
test/flake-failed-tests.test.ts added +32
@@ -0,0 +1,32 @@
1 import { expect, test } from "bun:test";
2 import { failedTests } from "../src/checks/flake.ts";
3 import { tally } from "../scripts/shards.ts";
4
5 test("a tally echo after the budget re-time's note is not filed under that note's file (#17291)", () => {
6 const a = ["test/a.test.ts:", "(fail) a breaks [1.00ms]", "", " 0 pass", " 1 fail", "Ran 1 test across 1 file. [3.00s]"];
7 const b = ["test/b.test.ts:", "", " 1 pass", " 0 fail", "Ran 1 test across 1 file. [4.00s]"];
8 const note = [
9 "test/b.test.ts:",
10 "(fail) b is slow took 2.50 s, over the 2 s test budget: make it faster, or name its file in SLOW in scripts/gate.ts with an issue",
11 ];
12 const ending = tally(
13 [
14 { files: ["test/a.test.ts"], code: 1, output: a.join("\n") },
15 { files: ["test/b.test.ts"], code: 1, output: [...b, ...note].join("\n") },
16 ],
17 7,
18 );
19 const log = [
20 "── shard 1/2 (exit 1, 3.0s): test/a.test.ts", ...a,
21 "── shard 2/2 (exit 0, 4.0s): test/b.test.ts", ...b,
22 "── over the budget beside other files: timing 1 file(s) again, alone, for at most 60 s: test/b.test.ts",
23 ...note,
24 "",
25 ...ending.lines,
26 ];
27 expect(ending.lines).toContain("(fail) a breaks [1.00ms] [shard 1]");
28 expect(failedTests(log)).toEqual([
29 { file: "test/a.test.ts", name: "a breaks", ms: 1 },
30 { file: "test/b.test.ts", name: note[1]!.slice("(fail) ".length) },
31 ]);
32 });

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs