vscode
vscode copied to clipboard
v0.5.0 failing to activate in a monorepo with vitest.workspace.ts and per-package vite.config.ts
Describe the bug
I was curious to try it out the new pre-release version with https://github.com/chriswheeldon-peakon/vitest-workspace-cwd but the extension fails to load with:
2024-03-15 14:27:52.495 [error] Activating extension vitest.explorer failed due to an error:
2024-03-15 14:27:52.495 [error] Error: Attempted to insert a duplicate test item ID /Users/jbloggs/code/vitest-workspaces
at Object.replace (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:138:24636)
at Ge.reset (/Users/jbloggs/.vscode/extensions/vitest.explorer-0.5.0/dist/extension.js:7:1888)
at Tt.defineTestProfiles (/Users/jbloggs/.vscode/extensions/vitest.explorer-0.5.0/dist/extension.js:7:5932)
at async Tt.activate (/Users/jbloggs/.vscode/extensions/vitest.explorer-0.5.0/dist/extension.js:7:7329)
...
This is a monorepo with multiple vite.config.ts files (one in each package) and a vitest.workspace.ts in the repo root.
Reproduction
https://github.com/chriswheeldon-peakon/vitest-workspace-cwd
System Info
System:
OS: macOS 14.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 29.92 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.11.1 - /var/folders/sb/jdkc4cv91zvgvvzwhq9lyc6w0000gp/T/fnm_multishells/12774_1710423566735/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.4 - /var/folders/sb/jdkc4cv91zvgvvzwhq9lyc6w0000gp/T/fnm_multishells/12774_1710423566735/bin/npm
IDEs:
VSCode: 1.87.2 - /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code
Vim: 9.0 - /usr/bin/vim
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
Browsers:
Chrome: 122.0.6261.129
Safari: 17.3.1
npmPackages:
vitest: ^1.4.0 => 1.4.0
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
This should be fixed by 29831757b628c7c44752420f568227dce17493fe in 0.5.2
I am marking this as "needs test" to catch the regression in the future, but for now, we are breaking things/moving fast.
@sheremet-va can confirm the extension now loads in that repository! Thanks 🤩
Works for me too, is there a way to say "use vitest.explorer@^0.5.2" in devcontainer.json? I can't get that to work, and am forced to pin to a very specific version.