Skip to content

Tests: Improve Windows compatibility#382

Draft
swissspidy wants to merge 1 commit intomainfrom
fix/os-tests
Draft

Tests: Improve Windows compatibility#382
swissspidy wants to merge 1 commit intomainfrom
fix/os-tests

Conversation

@swissspidy
Copy link
Copy Markdown
Member

Fixes a macOS-specific failure caused by /var vs /private/var path expansion

Fixes a macOS-specific failure caused by `/var` vs `/private/var` path expansion
@github-actions
Copy link
Copy Markdown
Contributor

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Here are some useful Composer commands to get you started:

  • composer install: Install dependencies.
  • composer test: Run the full test suite.
  • composer phpcs: Check for code style violations.
  • composer phpcbf: Automatically fix code style violations.
  • composer phpunit: Run unit tests.
  • composer behat: Run behavior-driven tests.

To run a single Behat test, you can use the following command:

# Run all tests in a single file
composer behat features/some-feature.feature

# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123

You can find a list of all available Behat steps in our handbook.

@github-actions github-actions bot added the scope:testing Related to testing label Mar 31, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the scaffold plugin unit tests to use regex matching for error messages, improving flexibility in path validation. A review comment correctly identifies that hardcoded forward slashes in one of the new regex patterns will cause failures on Windows, suggesting a more generic pattern for better cross-platform compatibility.

"""
Error: Invalid plugin slug specified. No such target directory '{RUN_DIR}/wp-content/plugins/foo'.
"""
Then STDERR should match #Error: Invalid plugin slug specified\. No such target directory '.*wp-content/plugins/foo'\.#
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The regex uses hardcoded forward slashes (/) in the path wp-content/plugins/foo. On Windows, these separators are typically backslashes, which will cause the test to fail. Since this pull request is intended to improve Windows compatibility, the regex should be more flexible. Simplifying it to .*foo (matching the style used on line 271) would resolve this and maintain consistency across the test suite.

    Then STDERR should match #Error: Invalid plugin slug specified\. No such target directory '.*foo'\.#

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant