paratestphp / paratest

:computer: Parallel testing for PHPUnit
MIT License
2.31k stars 228 forks source link

Code coverage: Cache for static analysis has not been configured #859

Closed oriolvinals closed 4 months ago

oriolvinals commented 4 months ago
Q A
ParaTest version 7.4.1
PHPUnit version 11.1.3
PHP version 8.2.20

Summary

I'm trying to use pcov for test coverage with ParaTest. Actually, with PHPUnit works good, but with ParaTest I have an error.

Current behavior

The actual behavior is this warning/error message Cache for static analysis has not been configured

How to reproduce: command, code and error stack trace

My command is php -d pcov.enabled=1 vendor/bin/paratest --passthru-php="'-d' 'pcov.enabled=1'" --coverage-html=.phpunit/coverage

If i'm trying with PHPUnit with this command php -d pcov.enabled=1 bin/phpunit --coverage-html=.phpunit/coverage the tests and the coverage

Expected behavior

Run tests with coverage like it used to be with PHPUnit with same coverage result

oriolvinals commented 4 months ago

Adding flag --cache-directory=.phpunit the error changes

Warming cache for static analysis ... [00:04.855]
Processes:     8

In Selector.php line 60:

  No code coverage driver with path coverage support available  
Slamdunk commented 4 months ago

<cacheDirectory> attribute in phpunit.xml has to be set for Code Coverage to work properly with ParaTest, have you set it already?

oriolvinals commented 4 months ago

Thanks @Slamdunk, now works correctly!