Skip to content

[Bug]: Browser tests reload after optimizing react-dom client #2927

Closed

Description

@mwolson

Summary

The web browser test suite can fail when Vite discovers and optimizes react-dom/client after tests have already started. Vitest then reports an unexpected reload and can fail to dynamically import test modules during the reload.

Impact

Unrelated PRs can fail the required bun run --cwd apps/web test:browser CI step even when their changes do not touch the web browser test path. One observed failure imported several browser test files successfully, then Vite logged new dependencies optimized: react-dom/client, reloaded the test session, and src/components/ChatView.browser.tsx failed to import test/wsRpcHarness.ts.

Expected Behavior

Browser tests should start with all required shared dependencies pre-optimized so Vite does not reload the test session mid-run.

Notes

Vitest explicitly recommends adding dependencies that trigger mid-run optimization to optimizeDeps.include for stable browser tests.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions