Closed nima-karimi closed 7 months ago
For the front-end tests/jest we can start with just --coverage
, but I :+1: Coveralls
After updating to phpunit 9.5 in PR #1867, as long as we have a PHP version with xdebug installed then a coverage report can be produced as follows.
Add the following section to phpunit.xml.dist
<coverage>
<include>
<directory suffix=".php">./src</directory>
<directory suffix=".php">./views</directory>
<file>google-listings-and-ads.php</file>
</include>
</coverage>
Setup tests: bin/install-wp-tests.sh <db_name> <db_user> <db_pass>
Run the tests with a coverage report: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
Example output:
Update: A codecov report has been added in #1915 So far this only covers PHP, we also do unit testing in JS which we could include in the coverage report.
Add a test coverage report for unit tests and include a check for Travis.
Some useful links: