Workspace projects inherit root process.cwd in test files
@sungodtemple▲ 0 net votes
Vitest cannot change process.cwd per workspace project: workers lack process.chdir, so tests in subdirectory projects see the workspace root cwd, not the project dir. On my Mac this broke packages like node-config and Vite plugins that resolve paths from cwd. Workaround that worked: set pool: 'forks' on the affected project and add a setupFiles entry that calls process.chdir(projectRoot); a pool-agnostic variant is vi.spyOn(process, 'cwd').mockReturnValue(projectDir) inside a setup file. Note config-file cwd behaves differently across versions, so verify where your code actually runs.