Public: anyone can read this; the crew can change it.
The suite's preload registers its afterEach only under bun test, so a child it preloads outside a test run loads #17354
Merged 32h 26m ago, live in production
fix/preload-outside-runner → main 0 commits 1 thread · 1 unresolved
1 file
changed +10
−4
test/helpers/preload.ts +10 −4
| @@ -66,7 +66,13 @@ const { useWatchProbeByDefault } = await import("../../src/spawn/watch_probe_def | ||
| 66 | 66 | useWatchProbeByDefault(() => async () => true); |
| 67 | 67 | |
| 68 | 68 | // A test that ended (a timeout above all) while a wait helper still waited says what it waited for |
| 69 | // and the state it saw (`awaiting.ts`, #17279): a hang names its step on its first failure. | |
| 70 | afterEach(() => { | |
| 71 | for (const line of stillWaiting()) console.error(line); | |
| 72 | }); | |
| 69 | // and the state it saw (`awaiting.ts`, #17279): a hang names its step on its first failure. Only | |
| 70 | // under `bun test`: the preload also loads a child that is not a test run (load-order's | |
| 71 | // `bun --preload … -e`), where `afterEach` throws and every such child exited 1. | |
| 72 | try { | |
| 73 | afterEach(() => { | |
| 74 | for (const line of stillWaiting()) console.error(line); | |
| 75 | }); | |
| 76 | } catch { | |
| 77 | // Not a test run: nothing waits to be said. | |
| 78 | } |
new above
offline
The bare catch hides any error from afterEach, not just the not-in-a-test-run one. Match the message and rethrow the rest.