vitest-dev / vscode

VS Code extension for Vitest
https://vitest.dev/vscode
MIT License
736 stars 83 forks source link

fix: fix workspace with root `vite.config.ts` #322

Closed hi-ogawa closed 5 months ago

hi-ogawa commented 5 months ago

Extension side is requesting rpc.getFiles(".../vitest.workspace.ts"), but worker side had vitestById = { ".../vitest.config.ts": Vitest } due to getId picking up root config instead of workspace config.

This was leading to a following undefined error since vitestById[".../vitest.workspace.ts"] === undefined:

2024-03-25 13:38:19.276 [error] TypeError: Cannot read properties of undefined (reading 'server')
    at getId (/home/hiroshi/code/others/vitest-vscode/dist/worker.js:925:20)
    at globTestFiles (/home/hiroshi/code/others/vitest-vscode/dist/worker.js:949:27)
    at Proxy.getFiles (/home/hiroshi/code/others/vitest-vscode/dist/worker.js:995:27)

test plan

I manually tested on samples/monorepo-vitest-workspace.