Problem
docs/src/content/docs/testing/diagnosing-flakes.mdx (EN + DE) catalogues the fixed-cap failure mode twice, one level apart:
- "A budget the per-test timeout cannot reach" — an
awaitCondition budget at or above the cap. Remedy: a third argument, test(name, fn, cap), so the budget's label reports instead of the runner's message.
- "Real work in a hook, against a cap nobody set" —
beforeAll driving four compilers. Remedy: layered budgets, beforeAll(fn, HOOK_BUDGET_MS) with the spawn carrying its own smaller one.
#1392 was neither, and the page has no entry for it: real work in a test body, against a cap nobody set. tests/unit/CoreStaticImports.test.ts walked a 148-file / 1.28 MiB static import closure — 29 ms idle — inside test(), and a full --coverage gate stretched it to 6 723.89 ms, past bun's 5 000 ms default.
The distinction matters because both catalogued remedies are wrong here, and a reader who pattern-matches to the nearest entry will reach for one of them:
- A third argument is for a failure budget — a wait meant to expire and print a label. A closure walk has no budget; it is bounded work that always completes, so there is nothing to report and nothing to size.
- Layered budgets are for work behind a spawn boundary, where the inner operation can carry its own timeout. There is no boundary here.
The remedy that is right — move the work to module scope, which carries no per-test timeout at all — appears nowhere on the page, even though three guards in the repository already do exactly that (tests/unit/ci/AwaitConditionBudgets.test.ts, tests/unit/ci/WorkflowHygiene.test.ts, tests/unit/config/NoDeadConfigKeys.test.ts).
There is a second reason to write it down. The page's own advice for sizing a hook budget — "running several copies of the file at once is the cheapest way to get there" — does not transfer to this family, and I burned time proving it: the pre-fix file under 12 concurrent CPU hogs still ran in 31.45 ms and passed. Spawned work competes with external load; in-process work does not. Its multiplier comes from the host process's own heap, GC and coverage counters, which only a real whole-suite run recreates.
Proposed shape
A row in ## The catalog and a ### section, in both language mirrors, covering: the signature, why the two neighbouring remedies do not apply, the module-scope remedy with the three sibling guards named, and the negative result about external load.
Placement is constrained. The section must go after "Real work in a hook, against a cap nobody set" and before "Bun's timer quantum": the hook section opens with "the previous section's remedy has a counterpart" and closes with "Same principle as the section above", both pointing at the budget section, and both mirrored in the DE text ("nur eine Ebene weiter außen, auf einen Hook angewandt"). Inserting between them silently breaks two cross-references in two languages.
Checked and not a hazard, so they need no edit: "The second family is found by reading" (EN :116) counts the two families in "What repetition can and cannot find", not catalog rows; "That is a fifth family" (EN :370) cannot be table-derived, since the row it describes is already the 8th of 9.
Acceptance
Related: #1392, #1282, #1376.
Problem
docs/src/content/docs/testing/diagnosing-flakes.mdx(EN + DE) catalogues the fixed-cap failure mode twice, one level apart:awaitConditionbudget at or above the cap. Remedy: a third argument,test(name, fn, cap), so the budget's label reports instead of the runner's message.beforeAlldriving four compilers. Remedy: layered budgets,beforeAll(fn, HOOK_BUDGET_MS)with the spawn carrying its own smaller one.#1392 was neither, and the page has no entry for it: real work in a test body, against a cap nobody set.
tests/unit/CoreStaticImports.test.tswalked a 148-file / 1.28 MiB static import closure — 29 ms idle — insidetest(), and a full--coveragegate stretched it to 6 723.89 ms, past bun's 5 000 ms default.The distinction matters because both catalogued remedies are wrong here, and a reader who pattern-matches to the nearest entry will reach for one of them:
The remedy that is right — move the work to module scope, which carries no per-test timeout at all — appears nowhere on the page, even though three guards in the repository already do exactly that (
tests/unit/ci/AwaitConditionBudgets.test.ts,tests/unit/ci/WorkflowHygiene.test.ts,tests/unit/config/NoDeadConfigKeys.test.ts).There is a second reason to write it down. The page's own advice for sizing a hook budget — "running several copies of the file at once is the cheapest way to get there" — does not transfer to this family, and I burned time proving it: the pre-fix file under 12 concurrent CPU hogs still ran in 31.45 ms and passed. Spawned work competes with external load; in-process work does not. Its multiplier comes from the host process's own heap, GC and coverage counters, which only a real whole-suite run recreates.
Proposed shape
A row in
## The catalogand a###section, in both language mirrors, covering: the signature, why the two neighbouring remedies do not apply, the module-scope remedy with the three sibling guards named, and the negative result about external load.Placement is constrained. The section must go after "Real work in a hook, against a cap nobody set" and before "Bun's timer quantum": the hook section opens with "the previous section's remedy has a counterpart" and closes with "Same principle as the section above", both pointing at the budget section, and both mirrored in the DE text ("nur eine Ebene weiter außen, auf einen Hook angewandt"). Inserting between them silently breaks two cross-references in two languages.
Checked and not a hazard, so they need no edit: "The second family is found by reading" (EN
:116) counts the two families in "What repetition can and cannot find", not catalog rows; "That is a fifth family" (EN:370) cannot be table-derived, since the row it describes is already the 8th of 9.Acceptance
###section, EN and DE, placed after the hook section.Related: #1392, #1282, #1376.