vitest: Browser mode hanging on blank white screen, failing to load vitest/utils
Describe the bug
When trying to run a test in browser mode (playwright) with a basic example next.js application, the browser window opens but hangs on a blank screen and fails to load vitest/utils in the background.

Reproduction
Reproduction repository, based on vitest next.js example: https://github.com/ludwigbacklund/vitest-browser-bug-repro
Just run yarn test
, it will open a browser window and hang on a white screen. Check the console/network log.
System Info
System:
OS: macOS 13.3
CPU: (10) arm64 Apple M1 Pro
Memory: 774.77 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.nodenv/versions/16.13.1/bin/node
Yarn: 1.22.15 - ~/.nodenv/versions/16.13.1/bin/yarn
npm: 8.1.2 - ~/.nodenv/versions/16.13.1/bin/npm
Browsers:
Chrome: 111.0.5563.146
Safari: 16.4
npmPackages:
@vitejs/plugin-react: latest => 3.1.0
@vitest/browser: ^0.29.8 => 0.29.8
vitest: latest => 0.29.8
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 17 (9 by maintainers)
Commits related to this issue
- add @vitest/utils to devDependencies https://github.com/vitest-dev/vitest/issues/3124 — committed to bucketeer-io/javascript-client-sdk by yshrsmz a year ago
@ludwigbacklund can you try adding this to your Vite config file?
https://github.com/userquin/vitest-browser-vue (not working with Vite 4.3 beta 5, I need to review the dependencies)
It’s weird because it was resolved for me, I need to check it again soon. Thank you so much.