haoqunjiang / vite-jest

First-class Vite integration for Jest
MIT License
406 stars 51 forks source link

feat: allow use in workspaces #7

Closed maxbeatty closed 3 years ago

maxbeatty commented 3 years ago

previously, vite-jest assumed process.cwd() would contain node_modules in workspace environments, a parent directory may contain node_modules now, vite-jest will work in either setup


my project setup looks like:

if workspace-a/package.json had a test script vite-jest and was run from the root (i.e. npm run test --workspace workspace-a), it would attempt to write to workspace-a/node_modules/vite/dist/client which did not exist. now, it will correctly write to node_modules/vite/dist/client even though process.cwd() is workspace-a.

maxbeatty commented 3 years ago

it appears https://github.com/vitejs/vite/pull/4061 was included in vite@2.4.0 so maybe the PR here is to remove those lines entirely?