[wp-trac] [WordPress Trac] #53414: Add how to run php coverage reports to readme.md

WordPress Trac noreply at wordpress.org
Thu Oct 24 13:51:37 UTC 2024


#53414: Add how to run php coverage reports to readme.md
-------------------------------------------------+-------------------------
 Reporter:  pbearne                              |       Owner:  (none)
     Type:  enhancement                          |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.8
Component:  Build/Test Tools                     |     Version:
 Severity:  minor                                |  Resolution:
 Keywords:  needs-docs needs-refresh changes-    |     Focuses:  docs
  requested                                      |
-------------------------------------------------+-------------------------
Changes (by desrosj):

 * keywords:  needs-docs needs-refresh => needs-docs needs-refresh changes-
     requested
 * milestone:  Future Release => 6.8


Comment:

 A lot has changed since this was opened and it should be much easier to
 accomplish this with the Docker environment than the current PR suggests.
 Mainly, the changes in `docker-compose.yml` should no longer be necessary.

 The current process is:
 - In your `.env` file, update the `LOCAL_PHP_XDEBUG` variable to `true`
 and the `LOCAL_PHP_XDEBUG_MODE` variable to `coverage`.
 - Start the environment with `npm run env:start` or restart it with `npm
 run env:restart`.
 - Run the PHPUnit tests and supply additional arguments to configure
 coverage. For example, `npm run test:php -- --coverage-html ./coverage`
 generates an HTML format report.

 For the last item, I agree that we could introduce a new command in the
 `package.json` file similar to what the PR has, but I think there should
 only be one, `php:test-coverage` that calls `test:php` and passes all the
 needed arguments to generate all report formats we decide are necessary. I
 think HTML and text make sense as human-readable formats, and PHP as a
 machine readable one.

 I like how the current PR uses a top level `coverage` folder with format
 specific subfolders. We'll need to add this `coverage` folder to
 `.gitignore` and `svn:ignore` as well.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53414#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list