[wp-trac] [WordPress Trac] #53945: Local test workflow changes for installing Composer dependencies
WordPress Trac
noreply at wordpress.org
Tue Aug 17 17:48:32 UTC 2021
#53945: Local test workflow changes for installing Composer dependencies
------------------------------+-----------------------------
Reporter: hellofromTonya | Owner: (none)
Type: task (blessed) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords:
Focuses: |
------------------------------+-----------------------------
Related to: #47381, #46149
With the adoption of PHPUnit Polyfills (see ticket #46149 and changeset
[51559]), its dependencies are installed via and tests run using Composer
(see ticket #46149 and changeset [51545]).
For the CI, this makes sense. What about the [t instead build the Composer
extra steps `npm` / Docker workflow] when testing locally?
== The Problem
The npm workflow for running PHPUnit tests locally:
{{{
npm install
npm run build:dev
npm run env:start
npm run env:install
npm run test:php
}}}
- This works on the WP 5.8 branch ✅
- Does not work/run on trunk/master branch ❌
{{{
Error: The PHPUnit Polyfills library is a requirement for running the WP
test suite.
You need to run `composer update` before running the tests.
Once the dependencies are installed, you can run the tests using the
Composer-installed version of PHPUnit or using a PHPUnit phar file, but
the dependencies do need to be installed whichever way the tests are run.
}}}
Extra steps currently needed are:
- Step 1: Install and setup Composer locally
- Step 2: Install dependencies:
{{{
composer install
npm install
npm run build:dev
npm run env:start
npm run env:install
npm run test:php
}}}
These extra steps increase the complexity, barrier, and effort for
contributors.
== Proposal
This ticket proposes to move the extra steps into the Docker images as
part of the existing npm workflow. In other words, build it into the
tooling.
Why?
To avoid passing these steps on to contributors. With this change,
contributors can continue using the same npm commands to locally run
tests.
== What about alternative workflows?
Composer is and has been an alternative workflow. More advanced testing
scenarios may need it to enable/disable different PHP extensions. For
contributors who wish to use Composer locally, this alternative workflow
is available for them.
For those contributors who do not wish to use Composer or npm/Docker, they
can manually install PHPUnit, PHPUnit Polyfills, etc. and use the
`WP_TESTS_PHPUNIT_POLYFILLS_PATH` constant to specify where the polyfills
exist on their machine.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53945>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list