Tests: further improve Windows compatibility#519
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces several shell-specific commands, such as pwd, mkdir, and subshells, with wp eval calls and multi-step Behat instructions to improve cross-platform compatibility. The review feedback identifies several critical issues: potential syntax errors due to backslash escaping in shell commands, shell execution failures when handling multi-line output stored in variables, and the lack of exit code propagation when using wp eval for file system operations like mkdir. Additionally, improvements were suggested for the readability of quoted strings within the PHP snippets.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates the Behat feature specs for the extension-command package to reduce reliance on non-portable shell behavior, improving test execution on Windows.
Changes:
- Replace several shell-quoting-sensitive
wp eval '...'invocations with Windows-friendlier quoting. - Replace some filesystem shell checks/commands (
test -d,mkdir,pwd) with equivalentwp eval/PHP logic. - Skip a handful of scenarios on Windows where the steps depend on non-portable tooling (
chmod,sed, command substitution).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| features/theme.feature | Adjusts eval quoting and replaces directory existence check / mkdir with wp eval for better Windows portability. |
| features/theme-update.feature | Replaces .git directory creation with wp eval to avoid shell mkdir differences. |
| features/plugin.feature | Adjusts eval quoting and replaces directory existence check with wp eval for better Windows portability. |
| features/plugin-update.feature | Adds @skip-windows tags for non-portable scenarios; replaces .git creation with wp eval. |
| features/plugin-list-recently-active.feature | Adds @skip-windows for scenarios relying on shell substitution/newline behavior. |
| features/plugin-install.feature | Replaces pwd with wp eval + getcwd() and normalizes path separators for Windows. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
No description provided.