Skip to content

Conversation

connectdotz
Copy link
Collaborator

@connectdotz connectdotz commented Apr 3, 2025

resolve #1221

On Windows, when an absolute path command is enclosed in quotes and passed to parseCmdLine() in helpers.ts, the path.normalize() function misinterprets it as a relative path, appending an incorrect relative prefix. This bug surfaces during the generation of the default debug configuration, ultimately causing a crash in the vscode debug session.

It seems that previous versions of VS Code might have handled such quoted paths differently, though the precise behavior remains unclear. The fix is straightforward: strip any extraneous quotes from the command line argument before calling path.normalize(), rather than afterwards.

@connectdotz connectdotz requested a review from Copilot April 3, 2025 20:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/helpers.ts:317

  • Confirm that swapping the order to remove quotes before normalization is the intended fix, as this change may affect paths with edge-case characters.
parts[0] = normalize(removeSurroundingQuote(parts[0]));

tests/helpers.test.ts:394

  • [nitpick] Ensure that the use of template literals for this test case is intentional to cover unique quoting scenarios and that the expected behavior is fully verified.
${`'c:\jest' --arg1 "escaped \"this\" string" --arg2 2`}

@coveralls
Copy link

Pull Request Test Coverage Report for Build 14252200457

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 98.18%

Totals Coverage Status
Change from base Build 12873317865: 0.0%
Covered Lines: 4101
Relevant Lines: 4107

💛 - Coveralls

@connectdotz connectdotz merged commit 72dc316 into jest-community:master Apr 3, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Cannot run test in debug mode on Visual Studio Code February 2025 (version 1.98)
2 participants