vitest-dev / vitest-dev/vitest
coverage broken in browser mode in a rush/pnpm monorepo
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 94
Description
Describe the bug
When running with coverage
TypeError: Failed to fetch dynamically imported module: http://localhost:63315/@id/@vitest/coverage-v8/browser?import
It fails to import the module, most likely because in this setup modules are symlinked (i think)
Reproduction
https://github.com/Georgegriff/vitest-rush-coverage-repro
Clone repo
npm install -g @microsoft/rush
rush update
cd apps/vitest-react-app
rush test:run --coverage
Coverage fails to generate
If i delete the node modules, and in apps/vitest-rect-app run npm install instead and run
npm run test:run -- --coverage it works, further suggesting this is a bug resolving symlinks somewhere in vitest with coverage providers
System Info
System:
OS: macOS 15.7.1
CPU: (10) arm64 Apple M1 Max
Memory: 122.81 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.17.0 - ~/.nvm/versions/node/v20.17.0/bin/node
npm: 11.5.1 - ~/.nvm/versions/node/v20.17.0/bin/npm
pnpm: 10.17.1 - ~/.nvm/versions/node/v20.17.0/bin/pnpm
bun: 1.0.12 - ~/.bun/bin/bun
Deno: 1.34.3 - /opt/homebrew/bin/deno
Browsers:
Edge: 140.0.3485.94
Safari: 26.0.1
npmPackages:
@vitejs/plugin-react-swc: ^3.11.0 => 3.11.0
@vitest/browser: ^3.2.4 => 3.2.4
@vitest/coverage-v8: ^3.2.4 => 3.2.4
playwright: ^1.55.1 => 1.55.1
vite: ^6.0.0 => 6.3.6
vitest: ^3.2.4 => 3.2.4
vitest-browser-react: ^1.0.1 => 1.0.1
Used Package Manager
pnpm
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Georgegriff/vitest-rush-coverage-repro repository and run the documented Rush coverage command in apps/vitest-react-app, then compare it with the working npm installation path. Trace browser coverage's dynamic import of @vitest/coverage-v8/browser under the symlinked monorepo setup; done means coverage generates successfully with Rush and pnpm.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- playwright, typescript, vite
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100