Skip to content

chore: enable merged coverage reporting for unit and integration tests#270

Draft
GaryJones wants to merge 2 commits into2.xfrom
feature/coverage-infrastructure
Draft

chore: enable merged coverage reporting for unit and integration tests#270
GaryJones wants to merge 2 commits into2.xfrom
feature/coverage-infrastructure

Conversation

@GaryJones
Copy link
Contributor

Summary

  • Add phpunit/phpcov dependency for merging coverage reports
  • Add composer scripts for coverage workflow (coverage:unit, coverage:integration, coverage:merge, coverage)
  • Set processUncoveredFiles="false" to avoid class/function redeclaration errors

This enables combined code coverage reporting from both unit and integration tests using phpcov to merge the results.

Test plan

  • Verify existing CI workflows pass (unit tests, integration tests, CS/lint)
  • Run composer coverage:unit locally with Xdebug/PCOV enabled
  • Run composer coverage:integration with wp-env start --xdebug=coverage
  • Verify .cov files are generated in coverage/ directory

🤖 Generated with Claude Code

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>
@GaryJones GaryJones requested a review from a team as a code owner January 11, 2026 16:12
@GaryJones GaryJones self-assigned this Jan 11, 2026
@GaryJones GaryJones added the type: maintenance Routine maintenance and code quality improvements label Jan 11, 2026
@GaryJones GaryJones added this to the 2.0.0 milestone Jan 11, 2026
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>
@GaryJones GaryJones marked this pull request as draft January 11, 2026 21:31
@GaryJones
Copy link
Contributor Author

Not yet happy with this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: maintenance Routine maintenance and code quality improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant