diff --git a/src/helpers.ts b/src/helpers.ts index 25302ee5..a6ed985f 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -314,7 +314,7 @@ export const parseCmdLine = (cmdLine: string): string[] => { const parts = cmdLine.match(cmdSplitRegex) || []; // clean up command if (parts.length > 0 && parts[0]) { - parts[0] = removeSurroundingQuote(normalize(parts[0])); + parts[0] = normalize(removeSurroundingQuote(parts[0])); } return parts; }; diff --git a/tests/helpers.test.ts b/tests/helpers.test.ts index c777f880..ceac93c8 100644 --- a/tests/helpers.test.ts +++ b/tests/helpers.test.ts @@ -390,6 +390,8 @@ describe('platform-specific tests', () => { ${true} | ${'\\absolute\\jest --runInBand'} | ${{ cmd: '\\absolute\\jest', args: ['--runInBand'], program: '\\absolute\\jest' }} ${true} | ${'"\\dir with space\\jest" --arg1=1 --arg2 2 "some string"'} | ${{ cmd: '\\dir with space\\jest', args: ['--arg1=1', '--arg2', '2', '"some string"'], program: '\\dir with space\\jest' }} ${true} | ${'c:\\jest --arg1 "escaped \\"this\\" string" --arg2 2'} | ${{ cmd: 'c:\\jest', args: ['--arg1', '"escaped \\"this\\" string"', '--arg2', '2'], program: 'c:\\jest' }} + ${true} | ${'"c:\\jest" --arg1 "escaped \\"this\\" string" --arg2 2'} | ${{ cmd: 'c:\\jest', args: ['--arg1', '"escaped \\"this\\" string"', '--arg2', '2'], program: 'c:\\jest' }} + ${true} | ${`'c:\\jest' --arg1 "escaped \\"this\\" string" --arg2 2`} | ${{ cmd: 'c:\\jest', args: ['--arg1', '"escaped \\"this\\" string"', '--arg2', '2'], program: 'c:\\jest' }} `('$cmdLine', ({ cmdLine, expected, isWin32 }) => { if (!canRunTest(isWin32)) { return;