vscode-jest-runner
vscode-jest-runner copied to clipboard
Debugging a test with describe.each in a zsh terminal fails
When I try to debug a test using the debug button, on a macOS machine running zsh, the script generated by the extension contains the test name pattern -t \(.\*?\)
, which is parsed by zsh as a glob wildcard so nothing runs, I get the error
zsh: no matches found: (.*?)
Wrapping with quotation marks solves this.
didnt manage to make the escaping correct for all different terminals yet. thank for your report.
When you run a test with a regex in the name it single quotes the string and it works with zsh. When you debug a test with a regex in the name, the command line has \
quoting for the name and the causes zsh to barf (unless you have unsetopt nomatch
)
it(`has a test called ${x}`, () => {
expect(true).toBeTruthy();
});
Run ...
node 'node_modules/.bin/jest' '/Users/mtoy/test/stupid.spec.ts' -t 'has a test called (.*?)'
Debug ...
/usr/bin/env ... (stuff) ... /Users/mtoy/test/stupid.spec.ts -t has\ a\ test\ called\ \(.\*?\) --runInBand
zsh: no matches found: has a test called (.*
zsh wants that question mark to be quoted also ... or for you to run with unsetopt nomatch
(which I have in my .zshrc for now)
I have the same error, also on macOS with zsh.