Blog
Vitest browser mode: CORS with native fetch, MSW in Playwright, and polyfills that alter preflight behavior
Running tests in real browsers surfaces CORS issues Vitest’s node environment would miss entirely.
1 min read
vitesttestingcors
Coverage
v8 coverage in browser mode may attribute CORS failures to the wrong source files—verify line mappings.
Watch mode restarts can leak MSW handlers—reset CORS-related mocks between file changes.
Pool workers
Thread pool workers in Node tests do not share browser CORS—use project tags to separate suites.
Environment variables for API base URLs must be injected into browser providers explicitly.
