-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vitest failes to start in vscode >=1.90 when using Yarn PnP #426
Comments
i got same issue |
There is a small patch in 1.0.7. Please let me know if it works for you. |
Same thing with PNPM
|
@sheremet-va thanks for taking time to address this, after updating to latest version i get a different error on startup that is a bit similar to what others are reporting (thou it fails at loading different dependency): It should be reproducible using the repo at https://github.com/Nithanim-Work/vitest-reproducer |
@sheremet-va thanks, unfortunately with the minimal reproduction repo (https://github.com/Nithanim-Work/vitest-reproducer) extension still fails to start. I tried on 2 different machines and get the same error: (also tried bumping vitest to |
I see now why it happens. Does the extension work for you if you have Vitest installed globally? |
Not sure how to test that, |
I'm also able to repro (Yarn PNP with workspaces) and have tried installing the extension globally, no luck. You can get past this error and have extension make it past startup by installing whatever package it says is missing in the directory its looking for it... but you'll then run into issues when you try to run any test via the UI as each test's packages are going to be missing. |
I've encountered the same problem. My first instinct was to try Maybe that might be a path towards a workaround for this if we could get yarn to add an unplug with dependencies option, unless I'm just missing something and that already exists. Trying to also unplug the dependencies (e.g. Click here to see versions and logsVersionsVSCode: 1.92.2 Not unplugged
Unplugged
Added this to
Result:
|
After messing around for a while, I managed to figure out a workaround. The pnp loader doesn't seem to want to resolve modules the way the worker hopes to be able to (i.e. it doesn't seem to check the workspace at all unless the importer or the imported script are in the workspace). Not really sure if this is an issue with yarn or if the extension is meant to be doing something different (like using the plugin API or something) Unpacking vitest and pointing directly to it fixes the
"vitest.vitestPackagePath": ".yarn/unplugged/vitest-virtual-b853d33a81/node_modules/vitest/package.json"
"vitest.nodeEnv": {
"NODE_OPTIONS": "--require C:\\your\\path\\to\\.pnp.cjs --experimental-loader file:///C:/your/path/to/.pnp.loader.mjs",
}, i imagine there's a way to configure this so that you don't have to hard-set the paths but this works for me |
Thanks~~that works for me. The command yarn unplug -R vitest works, but without the -R parameter, it does not. Additionally, in Yarn versions 4 and above, you need to add pnpEnableEsmLoader: true to your yarnrc.yml file; otherwise, the .pnp.cjs and .pnp.loader.mjs files will not be found. |
I may be missing something, but I'm unfortunately still getting a startup crash with Yarn PnP on v1.2.10:
|
This is a different error that was never reported. I cannot help you unless you provide any kind of reproduction. Adding +1 will not help fix the issue. |
Node.js: v20.17.0 (with
Edit: adding a |
@TehPers please, check if v1.2.11 fixes it for you. |
@sheremet-va v1.2.11 fixed the issue I was seeing. Thank you! |
The latest version is working for me now. Thank you! |
Describe the bug
With latest VSCode (version 1.90.2) the extension fails to start Vitest in a project setup with Yarn PnP:
Downgrading VSCode to version 1.89.1 results in Vitest process being successfully created:
I suspect it has to do with Electron upgrade in latest VSCode release that comes bundled with Node.js 20.
Reproduction
https://github.com/Nithanim-Work/vitest-reproducer (reusing minimal example from #416)
Output
[INFO 21:10:03] [v0.12.4] Vitest extension is activated because Vitest is installed or there is a Vite/Vitest config file in the workspace. [INFO 21:10:04] [API] Running Vitest vpnp (web/vitest.config.ts) with Node.js: /Users/fima/.asdf/shims/node [Error 21:10:05] [Error Error] Vitest failed to start: y Error: Vitest failed to start: y at ChildProcess.f (/Users/fima/.vscode/extensions/vitest.explorer-0.12.4/dist/extension.js:18:5392) at ChildProcess.emit (node:events:514:28) at emit (node:internal/child_process:951:14) at process.processTicksAndRejections (node:internal/process/task_queues:83:21)
Version
0.12.4
Validations
The text was updated successfully, but these errors were encountered: