fix(web): restore globalThis.fetch after every test to stop cross-file leak
47bc8d39a0c1bdd19ffcc37154c3ade2da87bb3f
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: cc59ee94d69a
The `web safety/store/map primitives` describe block stubs `globalThis.fetch` (ending on a `"x".repeat(20)` / text-plain Response) but had no `afterEach` to restore it — only the sibling `web_fetch context contract` block did. Under vitest's `isolate: false` (set in 971b99f) that leaked stub bled into later test files sharing the worker: diff-review's `server-html-full` (10 failures — `text/plain` ≠ `text/html`, bodies of `x`) and super's `mockup` (2 failures). Deterministic-red on CI, flaky-green locally (worker-order dependent). Hoist fetch restoration to a file-level `afterEach`, so every test in every block hands the global back clean regardless of which block (or future block) mutated it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>