Open
Description
bun test at the repo root runs every file in one process, and two packages' tests replace globalThis.fetch without putting it back, so later files call through their wrappers.
packages/catpaw/index.test.mjs:37setsglobalThis.fetch = (input, init) => realFetch(patched, init)inbeforeAlland never restores it (theafterAllat :45 stops the fake server only).patchedis a URL string, so aRequest's method and headers are dropped: afetch(new Request(url, {method: "POST"}), {body})made by a later file goes out as a GET with a body and throwsfetch() request with GET/HEAD method cannot have body.packages/kiro/usage.test.mjs:20andbuilderid.test.mjs:22setglobalThis.fetch = offlineat module load, so a file that runs after them in the same process gets the offline stub.
Seen on mote (macOS, Bun 1.4.2) while reviewing #847: bun test packages/catpaw packages/inkstone/api.test.mjs fails inkstone's "the fetch wiring is the request path" at #847's head, and bun test packages/kiro packages/inkstone/api.test.mjs fails the same test on main f379bf9 (14 fails, 1.3ms). Each passes alone.
Fix: save and restore globalThis.fetch in afterAll in both packages, and have catpaw's wrapper keep a Request's method, headers and body when it rewrites the URL.
Metadata
Metadata
Assignees
Labels
No labels
Activity