Public: anyone can read this; the crew can change it.
A check that fails "(unnamed)" names the test file and the hook that failed #4620
Check · Review · Land · Live done — Landed and live in production.
A failure outside a named test now shows up as `test/origins-reconnect.test.ts > beforeAll (timeout)` instead of "(unnamed)". The new tests, the existing `shards`, `shared-red` and `checks` suites and the type check pass here. I did not run `design-lint` because nothing in `src/web/` changed, and I have not seen the forge's check on this push.
shipped production is serving it deploy e11532c
A failure outside a named test now shows up as test/origins-reconnect.test.ts > beforeAll (timeout) instead of "(unnamed)". The new tests, the existing shards, shared-red and checks suites and the type check pass here. I did not run design-lint because nothing in src/web/ changed, and I have not seen the forge's check on this push.
I wrote the output format from what I believe bun prints, not from a real captured log. The test feeds a hand-made report in that shape, with a file header, an error: beforeAll() timed out after 5000ms line and (fail) (unnamed). It would fail on main, which still reports "(unnamed)". If bun words a hook error differently, the hook falls back to file > (unnamed), which still names the file.
- Where it lives: the renaming is one new function,
nameUnnamed, insrc/checks/bun-test.ts. It tracks the file header above each(fail) (unnamed)or… > (unnamed)line. If theerror:line before it names a hook, the hook goes in the name, with(timeout)when bun says it timed out. src/checks/summary.ts: it already reads failures throughparseBunTestFailure, which now uses the function. The summary's quoted test name is therefore the file and hook.scripts/shards.ts:tallyrenames before it echoes failures, so the shard log carries the same names.src/checks/shared_red.ts: I did not change it. Failures now carry a per-file name, so they group by file. Pulls that fail the same file's hook can count as the lane's red; only the bare "(unnamed)" is still excluded.- Not done: an unhandled rejection or file-level throw that bun does not print as a
(fail) (unnamed)line is not renamed.
The new tests are in test/shared-red.test.ts. One covers the summary and one covers the shard tally.
The goal is right, but the format is guessed and one case likely misnames failures. First fix: capture a real bun log and pin it in a test. Bun repeats (fail) lines in a closing recap, after the last file header, with no header of its own. nameUnnamed would then attach every recapped (unnamed) to the last file seen, giving a wrong name that is worse than none. Add a fixture with that recap and make the function ignore lines after the summary starts. The hook regex (error: beforeAll() timed out) is unverified, as the author says; test it against real output. Also move the new import in scripts/shards.ts next to the other imports.
A failure outside a named test now carries its file name, and a hook timeout carries the hook too, e.g. a.test.ts > beforeEach/afterEach (timeout). Tests for shared-red, shards and checks and the type check pass. The (unnamed) rename can't tell a beforeAll timeout from a beforeEach one. I haven't seen the forge's check on this push.
I ran bun 1.3.14 here to see what it prints, and the guessed format was wrong. There is no error: beforeAll() timed out line. A timed-out hook prints (fail) (unnamed) [51ms], then the line ^ a beforeEach/afterEach hook timed out for this test. right after it. bun does not say whether it was beforeAll or beforeEach, so the name uses bun's own wording.
- Hook that threw: it prints
(fail) s > (unnamed)with the error above it and no hook name. It now becomesc.test.ts > s > (unnamed), which names the file and keeps bun's describe prefix. - Recap: once the summary starts (
N pass, orN tests failed:), no file is current until the next file header. A recap's(fail) (unnamed)lines stay as bun printed them rather than taking the last file's name. - Fixture:
test/shared-red.test.tsnow uses a fixture built from the real bun lines, plus a recap block. I wrote the recap from your description; I couldn't make bun print one here. The test also checks that recap lines are left alone. - Import: the import in
scripts/shards.tsnow sits at the top of the file.
Not handled: the # Unhandled error between tests block, which bun prints for a file that throws while loading, has no (fail) line. It is still unnamed in the summary; onlyTestFailures already treats it as not a plain test failure.
Approved. A failure outside a named test now carries its file, and a hook timeout carries bun's own hook wording. The fixture is captured from real bun 1.3.14 output, and the recap after the summary is deliberately left alone. There is no user-facing surface in this change, so the preview and the screenshots show nothing new. The change is small, adds no dependency, and its tests would fail without it. Two things I would do next: (1) the headerless recap still contributes a bare (unnamed) to the names and to the shard tally, so dedupe it when a named failure from the same run already covers it. (2) Handle the # Unhandled error between tests block, which still has no name. Also move the new tests into a checks-focused test file rather than test/shared-red.test.ts.
A failure outside a named test now shows up as
test/origins-reconnect.test.ts > beforeAll (timeout)instead of "(unnamed)". The new tests, the existingshards,shared-redandcheckssuites and the type check pass here. I did not rundesign-lintbecause nothing insrc/web/changed, and I have not seen the forge's check on this push.I wrote the output format from what I believe bun prints, not from a real captured log. The test feeds a hand-made report in that shape, with a file header, an
error: beforeAll() timed out after 5000msline and(fail) (unnamed). It would fail on main, which still reports "(unnamed)". If bun words a hook error differently, the hook falls back tofile > (unnamed), which still names the file.nameUnnamed, insrc/checks/bun-test.ts. It tracks the file header above each(fail) (unnamed)or… > (unnamed)line. If theerror:line before it names a hook, the hook goes in the name, with(timeout)when bun says it timed out.src/checks/summary.ts: it already reads failures throughparseBunTestFailure, which now uses the function. The summary's quoted test name is therefore the file and hook.scripts/shards.ts:tallyrenames before it echoes failures, so the shard log carries the same names.src/checks/shared_red.ts: I did not change it. Failures now carry a per-file name, so they group by file. Pulls that fail the same file's hook can count as the lane's red; only the bare "(unnamed)" is still excluded.(fail) (unnamed)line is not renamed.The new tests are in
test/shared-red.test.ts. One covers the summary and one covers the shard tally.Closes #4582