vscode-jest-runner icon indicating copy to clipboard operation
vscode-jest-runner copied to clipboard

Quote for both run and debug so it.each works

Open tlbdk opened this issue 2 years ago • 3 comments

it.each([1,2,3,4])('should parse and generate %i and generate it again', id => {
...
})

Will generate the following command run:

node 'node_modules/.bin/jest' '/Users/tlb/git/connectedcars/ingester-tl-v2/src/lib/traffilog-parser/tools/monitor-csv-parser.test.ts' -t 'parser should parse and generate (.*?) and generate it again'

and the following command with debug:

... node node_modules/.bin/jest --testTimeout=100000000 --detectOpenHandles /Users/tlb/git/connectedcars/ingester-tl-v2/src/lib/traffilog-parser/tools/monitor-csv-parser.test.ts -t parser\ should\ parse\ and\ generate\ \(.\*?\)\ and\ generate\ it\ again --runInBand 

Resulting in:

zsh: no matches found: parser should parse and generate setting (.*?) and generate it again

tlbdk avatar Apr 26 '23 11:04 tlbdk

thanks for your contribution

firsttris avatar Jul 18 '23 04:07 firsttris

@firsttris hello, I've stumbled upon this issue too and glad to see that fix exists. Kindly advice if you plan to accept this PR.

fenixil avatar Aug 14 '23 15:08 fenixil

Some more info I found, ? is a wildcard character in zsh

~ > echo ?
zsh: no matches found: ?

In bash, it just prints ?.

So escaping provided by the vscode api does not escape the ? (and nor should it I think?): https://github.com/firsttris/vscode-jest-runner/blob/e3f7c76334c248ff426fd078a7634213b4106174/src/jestRunner.ts#L159

For powershell on windows, it is trying to match against literal double quotes, so it finds no matches (I don't think double quotes should be being used for powershell at all, but another problem).

Here is where powershell behaves differently to bash:

❯ echo """abc"""
"abc"

In summary, it seems fine to use single quotes on linux to solve this issue

domsleee avatar Sep 07 '23 13:09 domsleee