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 version = undefined #142

Closed
doei opened this issue Mar 21, 2023 · 13 comments
Closed

Vitest version = undefined #142

doei opened this issue Mar 21, 2023 · 13 comments
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@doei
Copy link

doei commented Mar 21, 2023

image

In the screenshot above the green play arrow is not clickable, with the error log shown in the vitest output.
Seems to be related to #44 and #88, but it doesn't appear to be fixed for me.

Environment

  • OS: macOS
  • VSCode version: 1.76.2
  • Vitest version: 0.29.3
  • Vitest plugin version: 0.2.39

Additional context

I am running in a docker container, from the official node image node:lts-alpine
It works without issue when ran from the command line:
image

@doei doei added the p3-minor-bug An edge case that only affects very specific usage (priority) label Mar 21, 2023
@iGoodie
Copy link

iGoodie commented Apr 11, 2023

I also have the same issue. Although I suspect a path contains a space error.
My project folder is located under some path like so: E:/VS Code Workspace/MyProject, which has space characters in it.
And Vitest logs those:

[INFO 2:46:46 AM] Trying to get vitest version from e:\VS Code Workspace\MyProject\node_modules\.bin\vitest.cmd -v...
[INFO 2:46:46 AM] Trying to get vitest version from E:\VS Code\Code.exe e:\VS Code Workspace\MyProject\node_modules\.bin\vitest.cmd...
[INFO 2:46:46 AM] Error: Cannot get vitest version. Please open an issue at https://github.com/vitest-dev/vscode/issues and join the logs above.

However, when I run the command in PowerShell I get this:

$ &"e:\VS Code Workspace\MyProject\node_modules\.bin\vitest.cmd" -v
> vitest/0.30.1 win32-x64 node-v18.15.0

I haven't checked how the code tries to extract Vitest version, but I suspect that

@iGoodie
Copy link

iGoodie commented Apr 12, 2023

Actually, this won't be able to handle such case.
It won't be able to execute found command, when path name includes whitespaces

const child = spawn(command, args, {

Which I think will be fixed with #139, if it gets merged

@doei
Copy link
Author

doei commented Apr 12, 2023

Thanks for the investigation ! I hope this gets merged fast then.

@ilteoood
Copy link

With the latest version of the extension (0.2.40) I started to have the same problem.

Here are the logs:

[INFO 14:33:15] Trying to get vitest version from /Users/ilteoood/Documents/git/bmg/bv-be/node_modules/.bin/vitest -v...
[INFO 14:33:15] Command not found
[INFO 14:33:15] Trying to get vitest version from /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin) /Users/ilteoood/Documents/git/bmg/bv-be/node_modules/.bin/vitest -v...
[INFO 14:33:15] Command not found
[INFO 14:33:15] Error: Cannot get vitest version. Please open an issue at https://github.com/vitest-dev/vscode/issues and join the logs above.
[INFO 14:33:15] process.env.PATH = /Users/ilteoood/.nvm/versions/node/v18.12.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin
[INFO 14:33:15] vitest.nodeEnv = null
[Error 14:33:15] Error: Cannot get vitest version. Please open an issue at https://github.com/vitest-dev/vscode/issues and join the logs above.
[INFO 14:33:15] Vitest Workspace [bv-be]: Vitest version = undefined
[Error 14:33:15] Because Vitest version < 0.12.0 for every workspace folder, run/debug/watch tests from Vitest extension disabled.

But if I run the command on the terminal:

/Users/ilteoood/Documents/git/bmg/bv-be/node_modules/.bin/vitest -v
vitest/0.31.1 darwin-arm64 node-v18.12.1

@zxch3n
Copy link
Member

zxch3n commented May 18, 2023

Published another fix on 0.2.41 that should work on both mac and win

@zxch3n zxch3n closed this as completed May 18, 2023
@ilteoood
Copy link

Published another fix on 0.2.41 that should work on both mac and win

Yes, confirmed! Thank you so much!

@doei
Copy link
Author

doei commented May 25, 2023

Still not working for me on 0.2.41

image

My vitest version is 0.31.0

@whiterqbbit
Copy link

Still not working for me on Ubuntu 22.04

@moshikshechter
Copy link

Hi! I am also suffering from this. My env: WSL2 with Ubuntu, with the latest version (0.2.41)

@sjoerdvanBommel
Copy link

Same for me, doesn't seem to work with latest version (0.2.42). I created a similar (possibly duplicate) issue: #171. For me the play buttons become unclickable when watch mode is running (see mentioned issue).

@doei
Copy link
Author

doei commented Sep 11, 2023

@zxch3n can we please reopen this ?

@r1m
Copy link

r1m commented Oct 4, 2023

In my case I feel this is because of the combinaison of a node version manager (no global node installed) and pnpm.
Because if I look at the logs

[INFO 1:57:22 PM] Trying to get vitest version from /home/me/projects/my-project/node_modules/.bin/vitest -v...
[INFO 1:57:23 PM] Trying to get vitest version from /home/me/.vscode-server/bin/fdb98833154679dbaa7af67a5a29fe19e55c2b73/node /home/me/projects/my-project/node_modules/.bin/vitest -v...

The first command runs well in a terminal because node is in my path. But probably fails because it is not in the extension process.env.PATH
The second one fails because .bin/vitest is a bash shim created by pnpm not a direct nodejs module.

@r1m
Copy link

r1m commented Oct 4, 2023

If I add shims for my tools manager it works (rtx in my case): https://github.com/jdx/rtx#ide-integration
I should be similar with nvm and others

@github-actions github-actions bot locked and limited conversation to collaborators Feb 27, 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

8 participants