You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reproduced on 1.4.0 (also 1.4.1), and adding a data point on why this matters more than a convenience.
setDefaultTimeout is documented as file-scoped, and a preload only runs once per process — so a preload that calls it raises the budget for the first test file only; every later file in a sequential bun test run falls back to 5000ms. Minimal repro:
mkdir -p repro/probe && cd repro
printf '[test]\npreload = ["./setup.ts"]\n' > bunfig.toml
printf 'import { setDefaultTimeout } from "bun:test"\nsetDefaultTimeout(20_000)\n' > setup.ts
for n in a b c; do printf 'import { test, expect } from "bun:test"\ntest("%s", async () => { await new Promise((r) => setTimeout(r, 6500)); expect(true).toBe(true) })\n' $n > probe/$n.test.ts; done
bun test probe # 1 pass / 2 fail (b,c: "timed out after 5000ms")
bun test --parallel probe # 3 pass (each worker re-runs the preload)
bun test --timeout 20000 probe # 3 pass
The natural place to set a repo-wide default is [test] timeout in bunfig.toml — but as reported here it is silently ignored: with timeout = 20000 in [test] the run above is still 1 pass / 2 fail on 1.4.0. So today the only mechanism that reaches every file is the CLI flag, which has to be repeated at every bun test call site in CI.
Real-world impact: a monorepo preload raising the CI floor to 30s on windows-latest silently protected one file per job; a 9.3s test died at 5000ms and was chased as a Windows flake for weeks. A parsed [test] timeout (or a documented note that a preload's setDefaultTimeout is first-file-only) would have made that a one-line fix.
Run bun experiments/issue-82/reproduce-bun-timeout.mjs. The first child demonstrates the ignored TOML setting and the second demonstrates the workaround. Our consumer keeps explicit file-local timeouts for subprocess integration tests; it does not skip tests or extend budgets to hide hangs: link-foundation/csharp-ai-driven-development-pipeline-template#109 .
A parsed [test].timeout applied when initializing every test file would let consumers remove this duplicated setup. A regression should cover two sequential files so a preload affecting only the first file cannot appear to fix the setting. Adding current-version measured evidence to the existing report, with AI assistance.
Activity
willhoney7 commentedon Jan 23, 2026
Ran into this today. Would be great to have
timeoutas an option in the bunfig.toml.fix(test): move timeout config to CLI flag
tools: raise bun test's per-test timeout via bunfig preload, not the …
kmarcisz commentedon Jul 15, 2026
Same here, some of our tests are over 5s and we would like the per-test override be available in bunfig.
tools: raise bun test's per-test timeout via bunfig preload, not the …
code-yeongyu commentedon Sep 4, 2026
Reproduced on 1.4.0 (also 1.4.1), and adding a data point on why this matters more than a convenience.
setDefaultTimeoutis documented as file-scoped, and a preload only runs once per process — so a preload that calls it raises the budget for the first test file only; every later file in a sequentialbun testrun falls back to 5000ms. Minimal repro:The natural place to set a repo-wide default is
[test] timeoutin bunfig.toml — but as reported here it is silently ignored: withtimeout = 20000in[test]the run above is still 1 pass / 2 fail on 1.4.0. So today the only mechanism that reaches every file is the CLI flag, which has to be repeated at everybun testcall site in CI.Real-world impact: a monorepo preload raising the CI floor to 30s on windows-latest silently protected one file per job; a 9.3s test died at 5000ms and was chased as a Windows flake for weeks. A parsed
[test] timeout(or a documented note that a preload'ssetDefaultTimeoutis first-file-only) would have made that a one-line fix.ci: apply the test timeout budget to every file, not just the first
ci: apply the test timeout budget to every file, not just the first
konard commentedon Nov 14, 2026
Bounded reproduction on Bun 1.4.4, the current release on 2026-11-14: a single 6-second test with
[test] timeout = 7000still fails at 5000ms; the same test using file-localsetDefaultTimeout(7000)passes in 6 seconds. Script: https://github.com/link-foundation/csharp-ai-driven-development-pipeline-template/blob/issue-108-555c331829cb/experiments/issue-82/reproduce-bun-timeout.mjs (two finite child runs, no stress allocation).Run
bun experiments/issue-82/reproduce-bun-timeout.mjs. The first child demonstrates the ignored TOML setting and the second demonstrates the workaround. Our consumer keeps explicit file-local timeouts for subprocess integration tests; it does not skip tests or extend budgets to hide hangs: link-foundation/csharp-ai-driven-development-pipeline-template#109 .A parsed
[test].timeoutapplied when initializing every test file would let consumers remove this duplicated setup. A regression should cover two sequential files so a preload affecting only the first file cannot appear to fix the setting. Adding current-version measured evidence to the existing report, with AI assistance.