vitest-dev / vitest-dev/vitest
Using 'home' as vite base breaks vitest on linux filesystems
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
If you configure vite with
base: 'home',
test: {
//
},
...
and run "vitest" on any linux file systems, you get the following error:
Error: Failed to load url /projects/vitest-dev-vitest-98qlmqvh/node_modules/vitest/dist/spy.js (resolved id: /projects/vitest-dev-vitest-98qlmqvh/node_modules/vitest/dist/spy.js). Does the file exist?
❯ loadAndTransform node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51969:17
❯ ViteNodeServer._transformRequest node_modules/vite-node/dist/server.mjs:561:16
❯ ViteNodeServer._fetchModule node_modules/vite-node/dist/server.mjs:523:17
❯ Proxy.fetch node_modules/vitest/dist/chunks/resolveConfig.RxKrDli4.js:6647:22
❯ EventEmitter.onMessage node_modules/vitest/dist/chunks/index.68735LiX.js:104:20
This bug is not reproducible on macOS or Windows and occurs on both npm and pnpm. Configuring the base as '/home/' or '/home' has the same effect.
Reproduction (StackBlitz uses Linux)
https://stackblitz.com/edit/vitest-dev-vitest-98qlmqvh?file=vite.config.ts
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 StackBlitz reproduction and the vite.config.ts configuration using base: 'home'; run Vitest on a Linux filesystem and trace the failed module resolution shown in the error. Compare behavior with '/home/' and '/home', then add coverage for the regression and confirm Vitest loads its module successfully without changing the macOS or Windows behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, typescript, vite
- Domain
- testing-qa, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100