gcp-ai's test/network.mjs (from #307) replaced globalThis.fetch with one
that refuses every call. bun test runs every package in one process, so
the guard outlived gcp-ai's files: with #384 merged on top, all eight
Search1API tests that fetch their own 127.0.0.1 fixture failed with
"Unexpected network fetch in test: http://127.0.0.1:…/search" in the
repo-wide run, and passed alone. fetch now refuses only a non-loopback
host, as the socket, http and dns hooks beside it already did. The real
fetch stays inside the module, never on globalThis.
Run (sandbox HOME under TMPDIR, HTTPS_PROXY at a dead port):
- bun test packages/gcp-ai: 40 pass, 1 skip, 0 fail.
- A script importing the guard: a Bun.serve loopback fetch answers "ok";
https://example.com is refused and the process exits 1.
- bun test (whole repo) with this file over #384's merge: 2647 pass,
1 skip, 0 fail. Without it: 2638 pass, 9 fail (8 Search1API, plus one
gcp-ai Chrome test that lost its CDP connection, which passed in the
next run).
- bun scripts/check.mjs: every package ok.