Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quote for both run and debug so it.each works #311

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tlbdk
Copy link
Contributor

@tlbdk tlbdk commented Apr 26, 2023

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

Quote for both run and debug
@firsttris
Copy link
Owner

thanks for your contribution

@fenixil
Copy link

fenixil commented Aug 14, 2023

@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.

@domsleee domsleee self-requested a review September 7, 2023 11:40
@@ -177,7 +177,7 @@ export class JestRunner {
config.program = `.yarn/releases/${this.config.getYarnPnpCommand}`;
}

const standardArgs = this.buildJestArgs(filePath, currentTestName, false);
const standardArgs = this.buildJestArgs(filePath, currentTestName, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually oops, this breaks the given example on windows + powershell and windows + cmd
Reason is this line:

const q = isWindows() ? '"' : `'`;

cmd /C "set "NODE_OPTIONS=--require "c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js" --inspect-publish-uid=http" && set "VSCODE_INSPECTOR_OPTIONS={"inspectorIpc":"\\\\.\\pipe\\node-cdp.81396-aa5050a0-4.sock","deferredMode":false,"waitForDebugger":"","execPath":"C:\\Users\\user\\scoop\\apps\\nvm\\current\\nodejs\\nodejs\\node.exe","onlyEntrypoint":false,"autoAttachMode":"always","fileCallback":"C:\\Users\\user\\AppData\\Local\\Temp\\node-debug-callback-b17a11136f9e296d"}" && C:\Users\user\scoop\apps\nvm\current\nodejs\nodejs\node.exe node_modules/jest/bin/jest.js """c:/Users/user/git/examples/examples.test.ts""" -t """test with generated (.*?)""" --runInBand "

Maybe this arg should be based on !isWindows() instead?

Copy link
Collaborator

@domsleee domsleee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see comment, thanks

@domsleee
Copy link
Collaborator

domsleee commented Sep 7, 2023

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?):

vscode.debug.startDebugging(undefined, debugCommand.config);

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants