vitest-jetbrains-plugin
vitest-jetbrains-plugin copied to clipboard
0.6.6: error when running from intellij on windows
thanks for the plugin!
when running a test from intellij with the plugin version 0.5.0, i get:

i couldn't figure out how to force it to use vitest.cmd either (if that is the solution).
Maybe a bug caused by .cmd ext name. Could you try attached version?
vitest-jetbrains-plugin-0.5.0.zip
hi @linux-china - thanks, this seems to be fixed in 0.5.1 which i updated via ij plugins
ooi, where is the code hosted for Vitest Runner 0.5.1? this repo doesn't seem to correspond to it
hi @linux-china - unfortunately this issue is back with 0.6.3:
Error running 'vitest run -t "foo" src/components/bar.spec.ts': Cannot run program "C:\Program" (in directory "C:\Users\Foo\bar"): CreateProcess error=2, The system cannot find the file specified
looks like "Program Files" is unquoted
@simonmarshall yes, my bad. I have no Windows development, and a developer reported a bug with WSL on Windows. Could you post your os info, NODE_PATH and correct command to run Vitest tests? thanks.
hi @linux-china
- os is Win10 enterprise 20H2
- node is
C:\Program Files\nodejs\node.exe(note the space) - i suspect you're running the correct command args, but you need to wrap the path to node.exe with double quotes to prevent spaces being interpreted as arg separators, ie,
"C:\Program Files\nodejs\node" vitest..., if you don't want to just usenode vitest...and trust that node is in the PATH
does that help?
@simonmarshall could you have a test with other NOD_HOME without space, such as c:\node. I should confirm it was caused by space in path or cmd ext name. thanks
i'm not sure how i can do that, i'm just clicking on the green triangle in ij, there is no NODE_HOME defined in my env
i can confirm that if i try to run C:\Program Files\nodejs\node.exe vitest run -t ... in a cmd window, then i get the error: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
(same if i try to run C:\Program Files\nodejs\node vitest run -t ...)
and you can see above, if i run try to run via ij, then i get the error: Error running 'vitest run -t "foo" src/components/bar.spec.ts': Cannot run program "C:\Program" (in directory "C:\Users\Foo\bar"): CreateProcess error=2, The system cannot find the file specified
suggesting that it thinks i'm trying to run C:\Program and not C:\Program Files\nodejs\node.no-such-ext
(i'm assuming it's trying to run node, and run it with something like the above args, but i can't be sure ofc, since i can only see C:\Program part of the path)
Could you assign node ad npm path for project and have test?

ok, if i use an unzipped nodejs download, like so:

then the test fails differently:
Error running 'vitest run -t "foo" src/bar.spec.ts': Cannot run program "C:\Users\foo\Downloads\node-v16.17.0-win-x64\node_modules\npm" (in directory "C:\Users\foo\bar"): CreateProcess error=5, Access is denied
which suggests the earlier issue was due to unquoted path whitespace, at least
but, note that C:\Users\foo\Downloads\node-v16.17.0-win-x64\node_modules\npm is not a program, it's a folder containing npm's bin, lib, etc
if i force change the package manager path to C:\Users\foo\Downloads\node-v16.17.0-win-x64\node_modules\npm\bin\npm.cmd like so:

then i get this:
C:\Users\foo\Downloads\node-v16.17.0-win-x64\node_modules\npm\bin\npm.cmd exec -- vitest run -t "foo" src/bar.spec.ts
node:internal/modules/cjs/loader:959
throw err;
^
Error: Cannot find module 'C:\Users\foo\Downloads\node-v16.17.0-win-x64\node_mo
dules\npm\bin\node_modules\npm\bin\npm-cli.js'
�[90m at Function.Module._resolveFilename (node:internal/modules/cjs/loader:9
56:15)�[39m
�[90m at Function.Module._load (node:internal/modules/cjs/loader:804:27)�[39m
�[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/r
un_main:81:12)�[39m
�[90m at node:internal/main/run_main_module:17:47�[39m {
code: �[32m'MODULE_NOT_FOUND'�[39m,
requireStack: []
}
fwiw, if i set lang frameworks to a node interpreter that i then delete from the file system, then the test works successfully, since it runs npm.cmd exec -- vitest run -t ... instead
Next week, I will find a Windows laptop and fix this problem.
hi @linux-china - any luck sourcing a windows laptop?
0.6.6 still fails for me in the same way - looking like it's due to unquoted path whitespace
Error running 'vitest run -t "xxx" src/yyy.spec.ts': Cannot run program "C:\Program" (in directory "C:\Users\zzz"): CreateProcess error=2, The system cannot find the file specified
hi @linux-china,
I have the same problem using Windows + WSL
Cannot run program "\home\user\.nvm\versions\node\v16.17.1\bin\yarn" (in directory "\\wsl$\Ubuntu20.04LTS\home\user\workspace\project"): CreateProcess error=2, The system cannot find the file specified
Have you planned a fix?
Best regards,