-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect code coverage when process isolation is used #4283
Comments
Same problem here with php 7.4.3, phpunit 8.5.24. using pcov |
Same problem here with php 7.1.33 and PHPUnit 7.5.20 using XDebug |
PHPUnit 7.5 is no longer maintained, neither is PHP 7.1. |
I think I encountered this same issue with version 10.0.7 of phpunit. How to reproduce:
Both tests were run on the out of the box Laravel project. The only difference is the use of I tried with two separate PHP setups:
It would be nice to have process isolation working again as I have over 300 tests and my containers get killed with OOM during tests. @sebastianbergmann If you'd like I can open this as a new issue, given that this issue is almost a year old and originally reported for different environment. |
Yes, please. Please provide a minimal, self-contained, reproducing test case that shows the problem you are reporting. And please compare PHPUnit 10 without process isolation versus PHPUnit 10 with process isolation, not PHPUnit 9 versus PHPUnit 10. |
@sebastianbergmann My issue was the same as #5218 and resolved by #5221 Thanks for looking into it and get it resolved! |
Reported to pcov, answer was "This is an upstream problem: phpunit is failing to set the interpreter for the new process with the configuration from the parent process.":
See: krakjoe/pcov#51
Summary
The problem is, depending on how phpunit.xml is configured, I get two different coverage reports for the same file, one of which is less accurate. See screenshots:
Current behavior
Poor code coverage report about the switch statement.
How to reproduce
composer install
./vendor/bin/phpunit --configuration tests/phpunit.xml --coverage-clover clover.xml
Zip file contains:
Expected behavior
More accurate code coverage reports about the switch statement.
Workarounds
If I open tests/phpunit.xml and change
processIsolation="false"
toprocessIsolation="true"
the coverage is more accurate.Or, if I open tests/phpunit.xml and change:
processUncoveredFilesFromWhitelist="true"
to
processUncoveredFilesFromWhitelist="false"
the coverage is more accurate.Unfortunately, these workarounds improve this specific case, but worsen the overall metrics in my real project so I cannot use them.
The text was updated successfully, but these errors were encountered: