I am trying to set up a coverage report within the DIFF view for phabricator. I have the following configs:
.arcconfig
{
"project_id" : "SuperProject",
"conduit_uri" : "https://phabricator.dev/",
"unit.engine": "PhpunitTestEngine",
"unit.phpunit.binary": "./vendor/bin/phpunit",
"phpunit_config": "tests/phpunit.xml"
}
tests/phpunit.xml
<phpunit>
<testsuite name="unit">
<directory suffix="Test.php">unit/accountancy</directory>
....
<directory suffix="Test.php">unit/store</directory>
</testsuite>
<logging>
<log type="coverage-clover" target="../build/logs/clover.xml" />
</logging>
</phpunit>
But when I run arc unit --coverage --json
, I get something like the following:
{
"0": {
"namespace": null,
"name": "Restriction\\CalculatorTest::testGetDiscount with data set #0",
"link": null,
"result": "pass",
"duration": 0.00362205505371,
"extra": null,
"userData": "",
"coverage": [] <-- why is it empty?
},
...
}
Seems like arcanist is not picking up coverage info. I've tried even looking through the phabricator source code, but couldn't find a clue on how to enable that.
Any suggestions are very welcome!
add whitelist to your tests/phpunit.xml. Check https://phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.whitelisting-files