Skip to content

🧪 Testing Improvement: Extract and test shell escaping logic#25

Open
giankpetrov wants to merge 6 commits intoAndrevops:mainfrom
giankpetrov:fix-shell-testing-9374403997873129350
Open

🧪 Testing Improvement: Extract and test shell escaping logic#25
giankpetrov wants to merge 6 commits intoAndrevops:mainfrom
giankpetrov:fix-shell-testing-9374403997873129350

Conversation

@giankpetrov
Copy link
Copy Markdown
Contributor

Extract string shell escaping logic into a pure function escapeTextForShell without dependencies on vscode to allow testing it via the native Node.js test runner (node --experimental-strip-types --test) directly. Added testing for edge cases like PowerShell quotes, CMD escaping, and POSIX quotes.

…tor-validation-5599091117584387295

🧪 Add unit tests for GitExecutor path validation
Refactored `escapeForTerminal` in `src/utils/shell.ts` to extract the core logic into a pure function `escapeTextForShell` inside a new file `src/utils/shellEscape.ts`. This bypasses VS Code module loading errors in the native node test runner while allowing full test coverage. Added test coverage in `src/utils/shell.test.ts` for PowerShell, Windows CMD, and POSIX shell escaping logic.
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.

1 participant