vitest
vitest copied to clipboard
Using 'home' as vite base breaks vitest on linux filesystems
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
It was reported on Vite https://github.com/vitejs/vite/issues/18279 but I couldn't find a reproduction with only Vite, so probably having the issue here makes sense.