Skip to content

Commit

Permalink
coverage: Switch to raw coverage files (#40013)
Browse files Browse the repository at this point in the history
It turns out that there really aren't any really good generic coverage
reporting tools, the best you can get is something that highlights
covered lines without function/method stats, branch info, or anything
else fancy.

To provide useful coverage output, we're going to look instead at
generating separate coverage dashboards for PHP (PHPUnit) and JS
(jest/istanbul), each generated by those tools so we can get all the
useful info possible. To do that, we'll need all the coverage commands
to generate the tools' raw data formats rather than a lossy format like
clover.

As part of this conversion, we're adding `jest.config.cjs` everywhere so
we can consistently set `collectCoverageFrom`. By default the base
config will include non-test files under `src/`. Various packages need
additional dirs such as `components/`, and a root-level `index.jsx` or
`global.d.ts` seems common too. Then, since we have config files
everywhere, we can move `coverageDirectory` and `coverageReporters` into
the configs too.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11642430412

Upstream-Ref: Automattic/jetpack@161c7a6
  • Loading branch information
anomiex authored and matticbot committed Nov 2, 2024
1 parent c523c5d commit f4b4349
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"post-install-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"post-update-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-clover \"$COVERAGE_DIR/php/clover.xml\""
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\""
],
"test-php": [
"@composer phpunit"
Expand Down

0 comments on commit f4b4349

Please sign in to comment.