-
-
Notifications
You must be signed in to change notification settings - Fork 377
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
Code coverage changed between 9.2.17 and 9.2.18 #953
Comments
There's a lot to talk about here. First: IMHO Second: is Third: does a fix for the second point resolve the issue completely? No. /* 1 */ $var
/* 2 */ =
/* 3 */ 'a'
/* 4 */ .
/* 5 */ 'b'
/* 6 */ ; The only real executable line is Conclusion: a fix is needed to count variables as executable lines during Concat operations, but use |
Agreed. |
IIRC the reason why infection does it by default is a mix of historical reasons (humbug was doing so as well) and because the goal is to "make sure your tests are good". Since you cannot assert that your code is covered, allowing to mutate non covered codes allows to check that (since you can make infection fail if you don't meet the desired MSI score). Also there is an argument to be made that some mutants could be killed by other things than tests, such as phpstan/psalm type violation or an obscure black box bash script. Although I think we should be able to manage those scenarios regardless of the flag at some point. |
Posted a bug on Infection: infection/infection#1750 Meanwhile, I'll do my best to have meaningful CC here in the upcoming days |
Thank you so much for your work on this! |
for example:
xdebug outputs (/w opcache) only line 1 as executable (covered/uncovered) if if line 2 and line 3 should be covered, we need to analyse if variable is comming from const expr or not. Title should be changed to something like "Impl. local variable static analysis and add coverage line for non-const variable". We can then prune also definitively non-reachable |
This reverts commit d457c77.
Coverage decreased, mutants increased, caused mostly by some expressions no longer being considered as covered code. This is a regression that only affects our infection runs: not really other runtime bugs. For now, we pin to an older coverage tooling. Ref: sebastianbergmann/php-code-coverage#953
Fixes infection#1773 Because of sebastianbergmann/php-code-coverage#953, the current coverage reports used by `infection/infection` are unreliable, and we cannot reliably use them for computing covered mutants in most codebases. This patch introduces a temporary conflict, to be lifted after @Slamdunk's work on sebastianbergmann/php-code-coverage#964 lands in upstream. Quoting original issue: > As mentioned in the title, it would be useful to (temporarily) add `"conflict": {"phpunit/php-code-coverage": ">9.2.17"}` to the constraints of this package. > > The reason: coverage report became massively unreliable for the purposes of mutation testing starting with `phpunit/php-code-coverage:9.2.18`, as reported by @kukulich and acknowledged by @Slamdunk in sebastianbergmann/php-code-coverage#953 > > This is only a temporary measure: @Slamdunk has been talking with me about it, and he's hard at work on it in sebastianbergmann/php-code-coverage#964, which should fix the problem, but which may take more time to land. > > At this moment, many mutation test suites keep going red due to invalid reduced coverage (some packages were even at 100%, and need constant adjustments when `composer.lock` gets changed). > > Therefore, it would be healthy to declare an incompatibility in a new minor release, for now.
Fixes #1773 Because of sebastianbergmann/php-code-coverage#953, the current coverage reports used by `infection/infection` are unreliable, and we cannot reliably use them for computing covered mutants in most codebases. This patch introduces a temporary conflict, to be lifted after @Slamdunk's work on sebastianbergmann/php-code-coverage#964 lands in upstream. Quoting original issue: > As mentioned in the title, it would be useful to (temporarily) add `"conflict": {"phpunit/php-code-coverage": ">9.2.17"}` to the constraints of this package. > > The reason: coverage report became massively unreliable for the purposes of mutation testing starting with `phpunit/php-code-coverage:9.2.18`, as reported by @kukulich and acknowledged by @Slamdunk in sebastianbergmann/php-code-coverage#953 > > This is only a temporary measure: @Slamdunk has been talking with me about it, and he's hard at work on it in sebastianbergmann/php-code-coverage#964, which should fix the problem, but which may take more time to land. > > At this moment, many mutation test suites keep going red due to invalid reduced coverage (some packages were even at 100%, and need constant adjustments when `composer.lock` gets changed). > > Therefore, it would be healthy to declare an incompatibility in a new minor release, for now.
Fixed in #964 |
This patch reduces code size, therefore leading to generally lower scores. Until we completely switch to `pcov` and the upstream issues with `sebastianbergmann/php-code-coverage` are resolved, we will keep having sub-100% mutation test scores. Ref: sebastianbergmann/php-code-coverage#945 Ref: sebastianbergmann/php-code-coverage@c304be7 Ref: laminas/laminas-continuous-integration-action#130 Ref: sebastianbergmann/php-code-coverage#953
phpunit/php-code-coverage 9.2.17
phpunit/php-code-coverage 9.2.18
The problem is that infection/infection now think the line is not covered and reports mutants.
With phpunit/php-code-coverage 9.2.17:
10 mutants were not covered by tests
With phpunit/php-code-coverage 9.2.18:
68 mutants were not covered by tests
The text was updated successfully, but these errors were encountered: