vitest-jetbrains-plugin
vitest-jetbrains-plugin copied to clipboard
Using the test runner in PHPStorm does not work (WSL)
Running npm exec -- vitest run -t test tests/Frontend/Views/HelloWorld.spec.ts works fine as shown below.

But when I try to run through the green arrow in the gutter, I get the following error:

"CMD.EXE was started with the above path as the current directory."
The command also being run is npm.cmd exec ... instead of npm exec ...
I'm using the latest version of Vitest Runner (0.6.1) and on PhpStorm 2022.1
Could you try this version? vitest-jetbrains-plugin-0.6.2.zip
I get a new error when running from the green arrow - 'Cannot run program "D:\Program Files\nodejs\npm" (in directory "\wsl$\Ubuntu-18.04\home\saber\Code\codenames"): CreateProcess error=193, %1 is not a valid Win32 application'

It would seem that the IDE is having trouble using the correct npm/node and is trying to use it from Windows instead of the WSL Ubuntu. I have my node/npm set to the one in WSL Ubuntu.

I have no dev environment WSL. Please use following version and I use npm path from configuration now. vitest-jetbrains-plugin-0.6.2.zip
New error: Cannot run program "\home\saber.nvm\versions\node\v16.14.0\bin\npm" (in directory "\wsl$\Ubuntu-18.04\home\saber\Code\codenames"): CreateProcess error=2, The system cannot find the file specified

the correct command should be "\home\saber.nvm\versions\node\v16.14.0\bin\npm.cmd" on WSL?
@linux-china i think problem here is not in command but in directory and way how you run command. i don't know how jetbrains handle those wsl calls, but maybe something like this could also work:
wsl -d Ubuntu-18.04 \home\saber.nvm\versions\node\v16.14.0\bin\npx -- vitest run -t
or maybe just cut "\wsl${DISTRO_NAME}" out, and it will work
or maybe just cut "\wsl${DISTRO_NAME}" out, and it will work
@XiaNi @HalfLife7 I build a new version with this way, and anybody can try it?
strangely the same
Cannot run program "\home\xiani\.nvm\versions\node\v16.10.0\bin\npm" (in directory "\\wsl$\Ubuntu\home\xiani\_WORK\msa-3d\client"): CreateProcess error=2, The system cannot find the file specified
Hi, i have the issue too with WSL2

Error running 'npx vitest run -t "return the player name" src/entities/Player.test.ts': Cannot run program "C:\Users\lowsc\AppData\Roaming\npm\npx" (in directory "\\wsl$\Ubuntu-20.04\home\yann\dev\poc"): CreateProcess error=193, %1 n’est pas une application Win32 valide
vitest plugin try to use my windows npm instead of wsl npm, despite the configuration in phpstorm :

if i run it from the phpstorm runner it works :

Hello, running into this same issue using WSL. Is it possibly just the slashes causing the issue? Not sure how the IDE handles UNC paths.
The plugin calls:
\home\technimakri\.nvm\versions\node\v16.10.0\bin\npm
rather than:
/home/technimakri/.nvm/versions/node/v16.10.0/bin/npm