feat: add wp-env support for running integration tests#483
Open
enricobattocchi wants to merge 1 commit intotrunkfrom
Open
feat: add wp-env support for running integration tests#483enricobattocchi wants to merge 1 commit intotrunkfrom
enricobattocchi wants to merge 1 commit intotrunkfrom
Conversation
Add wp-env configuration and a convenience shell script to run WordPress integration tests inside Docker containers, removing the need for a local MySQL/WordPress setup. Supports --multisite, --coverage, --php and --wp version flags. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Open
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Context
The current integration test setup requires a local MySQL server and a manual WordPress test installation (via
install-wp-tests.sh). This makes it harder to run tests locally, especially for new contributors. Thewordpress-seoplugin already adoptedwp-envfor this purpose — this PR ports the same approach to Duplicate Post.Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
run-wp-env-tests.shconvenience script fromwordpress-seo, adapted for Duplicate Post (different plugin path, removed Yoast SEO-specific patches)."testsEnvironment": falsein.wp-env.jsonto avoid the deprecatedenv.testsconfiguration.@wordpress/envas a devDependency and new composer commands:test-wp-env,coverage-wp-env,wp-env:stop..nvmrcalready specifies Node 20, which is compatible with wp-env.Test instructions
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
yarn installto install dependencies.composer installif not already done.composer test-wp-env— all 109 integration tests should pass.composer test-wp-env -- --filter=Post_Duplicatorto verify running a specific test works.composer wp-env:stopto verify the environment stops cleanly.composer test-wp-env -- --multisitefor multisite mode.composer test-wp-env -- --php=8.3to override the PHP version.Relevant test scenarios
Test instructions for QA when the code is in the RC
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
Documentation
Quality assurance
Innovation
innovationlabel and noted the work hours.Fixes #