Skip to content
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 not starting up due to failed version check on windows #170

Closed
DetachHead opened this issue Jul 10, 2023 · 14 comments
Closed

Vitest not starting up due to failed version check on windows #170

DetachHead opened this issue Jul 10, 2023 · 14 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@DetachHead
Copy link

re-raising #88 because it was closed but the issue is still occurring for many people (myself included):

Describe the bug Hi there, Every time I start up vscode it keeps telling me, "Because Vitest version < 0.12.0 for every workspace folder, run/debug/watch tests from Vitest extension disabled."

Tried uninstall / install but it won't come up again.

Sth. I should be aware off ?

Thx!

To Reproduce have vitest 0.23.4 installed, used the cmd: npm init vue@3 to create a totally new package

installed your vitest extension.

Restart vscode, see error appearing.

Expected behavior possible to start the tests through test explorer or using the green play icon

Screenshots If applicable, add screenshots to help explain your problem. image

Environment windows 10, vscode : Version: 1.71.2 (user setup) Commit: 74b1f979648cc44d385a2286793c226e611f59e7 Datum: 2022-09-14T21:03:37.738Z Electron: 19.0.12 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 Betriebssystem: Windows_NT x64 10.0.19044 Sandkasten: No

* OS: [e.g. macOS]

* VSCode version:

* Vitest version:

* Vitest plugin version:

Additional context same setup on macos works

@DetachHead DetachHead added the p3-minor-bug An edge case that only affects very specific usage (priority) label Jul 10, 2023
@suerta-git
Copy link

mac os +1

@suerta-git
Copy link

any workaround?

@riuandg5
Copy link

riuandg5 commented Aug 7, 2023

I was also facing the same issue of "not detecting vitest version correctly from vitest vscode extension upon opening of the workspace". However, there was no problem when I installed the extension for the first time while setting up my project in the workspace.

Recently I tried adding "vitest.enable": true and "vitest.commandLine": "npx vitest" in vscode workspace settings and boom! it is working fine now.

@slabinfo
Copy link

I can confirm it on Linux, too.
It seems, reading from the logs, that the extension is using a wrong execution command:
[INFO 9:22:38 AM] Trying to get vitest version from /home/my/software/vscode/VSCode-linux-x64/code-insiders /home/my/dev/node_modules/.bin/vitest -v...
[INFO 9:22:38 AM] Error: Cannot get vitest version. Please open an issue at https://github.com/vitest-dev/vscode/issues and join the logs above.

Is it trying to run vitest -v through vscode?

@callmeberzerker
Copy link

It started happening both on my windows and mac machines. Any insight on why?

@callmeberzerker
Copy link

This somehow fixed itself on my end. Didn't do anything specifically!

@callmeberzerker
Copy link

This is interesting, it comes and goes - and I don't know due to what.

@zakaoai
Copy link

zakaoai commented Nov 30, 2023

Hello there, I finally want to try the new Yarn with PnP and seem to break a lot of vscode plugin.
Got :
Vitest Workspace [project]: Vitest version = undefined

@mzietlow
Copy link

mzietlow commented Dec 8, 2023

In my particular case, this was caused by a blank space in the path to my project.

After switching from C:\The Path\To My\Project to C:\The_Path\To_My\Project the vitest plugin was loading correctly again. (Just saw that this was also one of the workarounds mentioned in #88.)

While this workaround might work for me, this is still a big issue since changing the path might not always be as painless as it was in my case.

@zakaoai
Copy link

zakaoai commented Dec 8, 2023

In my particular case, this was caused by a blank space in the path to my project.

After switching from C:\The Path\To My\Project to C:\The_Path\To_My\Project the vitest plugin was loading correctly again. (Just saw that this was also one of the workarounds mentioned in #88.)

While this workaround might work for me, this is still a big issue since changing the path might not always be as painless as it was in my case.

Interesting but not my problem since I dont have any blank space in my project path

@mzietlow
Copy link

mzietlow commented Dec 8, 2023

I'll create a new issue then

@Sebaestschjin
Copy link

I'm on Windows changing the PATH settings, helped.

I have an environment variable %NODE_HOME% that points to the node installation and the PATH variable contains this (e.g. %NODE_HOME%';%JAVA_HOME%/bin;%M2_HOME%/bin). I can start node from the command line/Git Bash/Powershell this way. But executing the vitest.cmd file in node_modules/.bin (which is what the extension also tries to do), gives the error that node can not be found. Removing the %NODE_HOME% varialbe from PATH and adding the path to node directly, fixes this problem and the vitest.cmd can be executed and the plugin also detects the vitest version.

So the issue seems to be vitest itself (or the .cmd file it creates), which seems to handle variables in the PATH variable incorrectly or something.

@linzhe141
Copy link

It may have something to do with the node version. After executing nvm use 18, reload vscode will work normally.

@sheremet-va
Copy link
Member

This should be fixed in pre-release 0.5.0 and higher. Note that the extension now requires Vitest 1.4.0 or higher.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

No branches or pull requests

10 participants