-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execute Unit Tests in wp-env
#32456
Execute Unit Tests in wp-env
#32456
Conversation
f9f1fed
to
48cd5f5
Compare
b715792
to
48cba90
Compare
7a64074
to
c62dbf7
Compare
I've landed an upstream change in |
This allows us to run unit tests without running the install.sh script that used to download a version of WordPress and associated tests.
This moves our unit test execution into the `wp-env` tests container. This also updates the CI workflow file so that it will also execute the tests in the environment.
The permissions on the `wp-env` container prevent manipulating files and folders outside of the web root. This means that the traversal test cannot function correctly. Technically this decreases the quality of the test, since it is ambiguous whether or not the test failed due to the missing file, but technically speaking, there's no easy way to make this work.
There are a few tests that fail when ABSPATH is not absolute.
With the position of the plugin now in the correct location, path tokenization for the template cache works in tests. This tokenizes the expected path so that the test is no longer failing. As a bonus, this means we're now testing the tokenization too!
This changes the code coverage to use `wp-env` as well.
Since we're explicitly selecting 5.9 for the `wp-phpunit/wp-phpunit` package, we also want to explicitly use WordPress 5.9's version.
Since we aren't always using WordPress 5.9, we need to make sure that the version of the test package also matches WordPress.
Since `wp-env` now contains an environment variable for setting the Core version, we no longer need the hacky setup script in our workflows. This commit removes that and applies the change to `wp-env run` as well.
7011b35
to
3bf59d2
Compare
📊 Test reports for this pull request have been published and are accessible through the following links:
Latest commit referenced in the reports: Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them. |
Since this PR was initially created, a few different upstream changes have made much of it either obsolete or unnecessary. Rather than continuing to keep this open, I'm going to close the pull request in favor of making a new one once the final upstream change has been created. |
All Submissions:
Changes proposed in this Pull Request:
This pull request makes changes to the unit test suite in order to support executing the tests within the
wp-env
environment. This will make it easier for people to start developing locally since they won't need to do anything special to run the test suite anymore.Closes #32436.
How to test the changes in this Pull Request:
wp-env start
Other information:
Changelog entry
N/A
FOR PR REVIEWER ONLY: