Skip to content

test(ci): restore global fetch in shared vitest setup#131

Merged
ToadAid merged 6 commits into
mainfrom
test-fetch-isolation-restore
Mar 22, 2026
Merged

test(ci): restore global fetch in shared vitest setup#131
ToadAid merged 6 commits into
mainfrom
test-fetch-isolation-restore

Conversation

@ToadAid
Copy link
Copy Markdown
Owner

@ToadAid ToadAid commented Mar 22, 2026

Summary

Tighten shared Vitest fetch cleanup so cross-test fetch leakage is cleaned up without breaking intentional suite-level fetch setup.

What changed

Updated:

  • test/setup.ts

The shared test bootstrap now:

  • snapshots globalThis.fetch at the start of each test
  • restores globalThis.fetch to that per-test starting value after each test

Why this patch

A broad macOS CI failure pattern pointed to shared test-state leakage. One proven leak vector was manual globalThis.fetch mutation across suites.

The first bootstrap fix restored fetch to the process-original value, but that was too blunt for suites that intentionally install a fetch mock in beforeAll.

This refined version preserves suite-level setup while still cleaning up per-test leakage.

Scope

Changed only:

  • test/setup.ts

Did not change:

  • product/runtime code
  • Mirror status code
  • suite-local logic
  • workflows
  • packaging

Behavior

No product behavior changed.

This is a shared test-bootstrap isolation fix only.

Validation

Passed:

  • pnpm vitest run src/cli/program.nodes-media.test.ts
  • pnpm vitest run src/telegram/send.test.ts src/telegram/fetch.test.ts

Result:

  • program.nodes-media passed (9 tests)
  • telegram/send + telegram/fetch passed (62 tests)

Notes

This patch is intentionally narrow:

  • it fixes a proven shared leak point
  • it preserves intentional suite-scoped fetch mocks
  • it avoids broad test harness refactors

Other possible shared isolation seams may still exist, but they are out of scope for this patch.

@ToadAid ToadAid merged commit b155560 into main Mar 22, 2026
27 of 28 checks passed
@ToadAid ToadAid deleted the test-fetch-isolation-restore branch March 22, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant