Files
routstrd/tests/integrations
redshift bc1dbeb998 fix(tests): replace leaking mock.module in pi tests with injected deps
CI run 35723560562 failed 3 tests in tests/utils/daemon-client.test.ts:
getDaemonBaseUrl returned the default http://127.0.0.1:8008 even for an
explicit daemonUrl. Root cause: PR #111 added mock.module over
src/utils/daemon-client in tests/integrations/pi.test.ts. Bun's
mock.module overrides persist for the rest of the run in the same
worker, so when worker scheduling runs pi.test.ts after daemon-client.ts
has been imported (cached) but before tests/utils/daemon-client.test.ts,
the mocked getDaemonBaseUrl (host/daemonUrl-ignoring) replaces the real
one. Deterministic on CI's Linux ordering, non-reproducible locally.

mock.restore() does not revert mock.module, so fix at the seam instead:
installPiIntegration now accepts optional { callDaemon, getDaemonBaseUrl }
deps (defaulting to the real implementations) and pi.test.ts injects the
mock. No mock.module remains for src/utils/daemon-client, eliminating the
cross-file leak entirely.
2026-09-22 15:58:19 +03:00
..