firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
265 stars 124 forks source link

Jest cannot find ANY tests due to path/test description parsing error #254

Open krumpli84 opened 2 years ago

krumpli84 commented 2 years ago

I'm running the latest version of Jest Runner and VScode and it seems like this started happening after the latest update of both runner and VSC. The issue is that if I just click "Run" on any test it seems like it's just not getting all the path information. It removes letters from the path and adds it somewhere else. This happens in the path and also in test description.

Example: For clarity i underscored where the characters are missing and bolded where they are randomly appear and this randomized every time i try to run a test: -> node "nodemodules/jest/bin/jest.js" ":Users/myName/P_oject/testing/functicronal/simple_test.js -c "c/:Users/myName/Project/testing/config/jest.config.js" -t "t_st descri_tions herepe"

Another example is that letters are missing from words and not added anywhere else (like in ex above), semi-complete words are added in the middle of a path etc.

This is a strange issue that I haven't found anything about yet. Any ideas here?

krumpli84 commented 2 years ago

Might add that i run bash as default terminal

Aaron-Pool commented 2 years ago

I'm also experiencing this issue. I'm using bash on window with pnpm as my package manager.

firsttris commented 2 years ago

do you still experience this issue?

andreasdj commented 2 years ago

I'm following this thread due to having the exact same issue. For me the issue is still present.

Jest Runner version: v0.4.56 VS code version: 1.71.1

I'm using bash as the default terminal on Windows. The first run always works (when a new terminal is opened) but following runs fails (with scrambled characters in the resolved paths). If I kill the terminal and start a new test run using the context menu it works.

If I use the arrow up button inside the terminal after a successful run I get the previous command and can re-run the same test(s) as many times as I wish.

firsttris commented 2 years ago

On Linux it's working for bash, fish, zsh.

On windows I would suggest using Powershell. It also supports all bash commands.

andreasdj commented 2 years ago

Thanks for the tip. I can confirm that using Powershell as the default terminal on Windows doesn't seem to have the same issue as bash. I will probably move over to start using that.

krumpli84 commented 2 years ago

do you still experience this issue?

With Bash, yes but i changed to PowerShell and the issues are gone.

domsleee commented 10 months ago

I think there's an issue with the quoting logic: it should really be "is the current terminal cmd" instead of "is the current OS windows".

Specifically here, powershell and bash on windows should use single quotes (') but at the moment they're using double quotes ("):

https://github.com/firsttris/vscode-jest-runner/blob/b5097b30d55e493203fbc15df37898df48581594/src/util.ts#L3-L5

https://github.com/firsttris/vscode-jest-runner/blob/b5097b30d55e493203fbc15df37898df48581594/src/util.ts#L56-L59

bash/powershell will expand variables if quoted in double quotes, so this needs to be fixed.

Also powershell has issues around backticks, e.g.


echo "test`ntest"  # expands the newline
echo 'test`ntest'  # does not expand the newline