Make WordPress Core

Opened 3 years ago

Closed 5 weeks ago

Last modified 5 weeks ago

#53414 closed enhancement (fixed)

Add how to run php coverage reports to readme.md

Reported by: pbearne's profile pbearne Owned by: desrosj's profile desrosj
Milestone: 6.8 Priority: normal
Severity: minor Version:
Component: Build/Test Tools Keywords: needs-docs has-patch commit
Focuses: docs Cc:

Description

With the@Covers getting added in #39265 we need to make it easy to run/create the coverage reports

So let's add the instructions to the readme.md file

Change History (12)

#1 @pbearne
3 years ago

it looks like we will have to install xdebug into the runner for the coverage reports

#2 @hellofromTonya
3 years ago

  • Focuses docs added
  • Milestone changed from Awaiting Review to 5.9
  • Owner set to hellofromTonya
  • Severity changed from normal to minor
  • Status changed from new to assigned

Thanks @pbearne for creating this ticket. Moving it into 5.9.

This ticket was mentioned in PR #1418 on WordPress/wordpress-develop by pbearne.


3 years ago
#3

  • Keywords has-patch added; needs-patch removed

added support for local coverage reports

Trac ticket: https://core.trac.wordpress.org/ticket/53414

#4 @netweb
3 years ago

  • Keywords needs-refresh added; has-patch removed

#5 @hellofromTonya
3 years ago

  • Milestone changed from 5.9 to Future Release

Today is 5.9 Feature Freeze. I'll punt this to Future Release (as 6.0 isn't
available yet for selection).

Test and build tool changes are allowed after feature freeze up until RC. If someone is able to work on this before then, it can always be moved back.

#6 @hellofromTonya
9 months ago

  • Owner hellofromTonya deleted

As of today, I'm no longer a sponsored contributor and am starting a month or more AFK break. To not stand in the way, I'm clearing me as the ticket owner, which opens the ticket for someone to step in to shepherd this ticket forward to resolution.

#7 @desrosj
7 weeks ago

  • Keywords changes-requested added
  • Milestone changed from Future Release to 6.8

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.

This ticket was mentioned in PR #7647 on WordPress/wordpress-develop by @pbearne.


7 weeks ago
#8

  • Keywords has-patch added; needs-refresh removed

Introduced a new npm run test:test-coverage command for generating HTML test coverage reports. Updated README to reflect the new command and usage, and modified .gitignore to exclude coverage report files.

#9 @pbearne
7 weeks ago

  • Keywords changes-requested removed

@desrosj

I have added a new pull request (I broke the old one)
I found a way to avoid changing the .env file :-)

I could find the svn:ignore to update.

Lets get this in

#10 @desrosj
5 weeks ago

  • Keywords commit added
  • Owner set to desrosj

#11 @desrosj
5 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59356:

Build/Test Tools: Add script for generating code coverage report.

This adds documentation for how to generate code coverage reports to the README.md file.

test:coverage has also been added as an npm script to make it easier to generate a report using the local Docker environment. The script will generate an HTML, PHP, and text report file.

Props pbearne, hellofromTonya, netweb.
Fixes #53414.

Note: See TracTickets for help on using tickets.