#8554·vitest

HMR overlay captures test clicks and cannot be disabled

Author: steedemsCreated Sep 8, 2025Updated Oct 1, 2026
Labelsfeat: browserpending triage

Describe the bug

When using Vitest browser mode, tests re-run before the error HMR overlay is removed. This causes test interactions (like clicks) to be intercepted by the overlay, resulting in unintended behaviour such as opening editor links from the stack trace.

Additionally, the server.hmr.overlay: false configuration option in vitest.browser.config.ts is ignored and does not disable the overlay as expected.

Reproduction

Checkout vitest-hmr-overlay-troubleshoot.

bash
git clone https://github.com/steedems/vitest-hmr-overlay-troubleshoot.git
  1. Run pnpm test:browser - test should pass
  2. Introduce a syntax error in HelloWorld.test.tsx (e.g., remove a quote from the test name)
  3. HMR overlay appears showing the syntax error and stack trace ✓
  4. Fix the syntax error
  5. The test re-runs before the HMR overlay is removed. Therefore, clicks fired by the test itself underneath the overlay are captured by the overlay and links of the stack trace are opened in the editor ✗

Additional issue:

Image

System Info

bash
System:
    OS: macOS 15.6.1
    CPU: (10) arm64 Apple M2 Pro
    Memory: 91.61 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.17.0/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.17.0/bin/npm
    pnpm: 9.12.1 - ~/Library/pnpm/pnpm
    Watchman: 2024.09.23.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 139.0.7258.157
    Safari: 18.6
  npmPackages:
    @vitejs/plugin-react: ^5.0.0 => 5.0.2
    @vitest/browser: ^3.2.4 => 3.2.4
    playwright: ^1.55.0 => 1.55.0
    vite: ^7.1.2 => 7.1.5
    vitest: ^3.2.4 => 3.2.4
    vitest-browser-react: ^1.0.1 => 1.0.1

Used Package Manager

pnpm

Validations