Add comprehensive unit tests for execUtils.ts #873
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds comprehensive unit test coverage for the
execUtils.ts
utility functions that handle argument quoting for command execution.Overview
The
execUtils.ts
module contains two utility functions used throughout the extension:quoteStringIfNecessary(arg: string)
: Adds quotes around strings containing spaces (unless already quoted)quoteArgs(args: string[])
: Maps the quoting function over an array of argumentsThese functions are critical for properly escaping command-line arguments, especially on Windows where paths often contain spaces (e.g.,
C:\Program Files\Python
).Test Coverage Added
Created
src/test/features/execution/execUtils.unit.test.ts
with 25 comprehensive tests:quoteStringIfNecessary
tests (15 tests):quoteArgs
tests (10 tests):--flag "value with spaces"
)Testing Approach
Following the repository's testing workflow instructions:
*.unit.test.ts
naming convention for fast, isolated testingVerification
All tests pass successfully:
Total test suite remains healthy: 170 tests passing with no regressions.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.