chore: enable merged coverage reporting for unit and integration tests#270
Draft
chore: enable merged coverage reporting for unit and integration tests#270
Conversation
Introduces infrastructure to combine code coverage from both unit tests (run directly via PHPUnit) and integration tests (run through wp-env) into unified reports. Previously, coverage could only be generated for one test suite at a time, preventing accurate assessment of total test coverage across the codebase. Changes include adding phpcov for merging coverage data, creating composer scripts to orchestrate the three-step process (unit coverage, integration coverage, merge), and disabling processUncoveredFiles to prevent class redeclaration errors when generating coverage in the wp-env environment where files may already be loaded. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds automated coverage tracking visible in PRs before merging. The workflow runs separately for unit and integration tests to accommodate their different coverage drivers (PCOV for speed in unit tests, Xdebug for wp-env integration tests), uploads both as artifacts, and displays coverage summaries in the GitHub Actions step summary. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
|
Not yet happy with this PR. |
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.
Summary
phpunit/phpcovdependency for merging coverage reportscoverage:unit,coverage:integration,coverage:merge,coverage)processUncoveredFiles="false"to avoid class/function redeclaration errorsThis enables combined code coverage reporting from both unit and integration tests using phpcov to merge the results.
Test plan
composer coverage:unitlocally with Xdebug/PCOV enabledcomposer coverage:integrationwithwp-env start --xdebug=coverage.covfiles are generated incoverage/directory🤖 Generated with Claude Code