Skip to content

fix(web): clean up React tests globally#993

Draft
swear01 wants to merge 1 commit into
tiann:mainfrom
swear01:codex/fix-web-test-global-cleanup
Draft

fix(web): clean up React tests globally#993
swear01 wants to merge 1 commit into
tiann:mainfrom
swear01:codex/fix-web-test-global-cleanup

Conversation

@swear01

@swear01 swear01 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add explicit React Testing Library cleanup in the shared web Vitest setup.
  • Prevent React work from leaking past jsdom teardown when tests use render/renderHook without local cleanup.

Root cause

web/vitest.config.ts uses globals: false, so React Testing Library's auto-cleanup is not reliably registered through the usual global hook path. A few web tests render React components/hooks without local cleanup(), leaving scheduled React work alive after jsdom has already removed window. On upstream main (b44885a), this surfaced in CI as Vitest unhandled ReferenceError: window is not defined errors after all web tests had otherwise passed.

Testing

  • bun run test:web -- src/hooks/useThemeColors.test.ts
  • bun typecheck && bun run test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant