-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
List of source directories is not respected in regard of more extensive coverage report #1264
Comments
That's a BC break in this version: it always mutates "covered" files unless you exclude them with a filter or from coverage altogether. The easiest way to do the latter is to configure
There's also a blacklist of sorts if that's more convenient. Just for the completeness of the report, would you mind showing your |
@sanmai thanks for the information, I've updated the issue to include my Just to clarify, are you saying we filter the coverage generation to only include the "functional core" and anything code that's not covered by unit tests will then not be mutated? Is this an expected BC break? It's not specified in the changelog or the blog post. |
Unfortunately, it isn't explicitly specified. Nor thought over much (by me), for that matter. Yes, it should work that if you filter the coverage to include only things you want to be mutated, then only included files will be mutated. I use this feature every time when I need to iterate quickly over a piece of code where I couldn't care about all other code. You have to keep your configuration as it is, though. |
I would say this is a bug, not an expected BC break between 0.15 and 0.16. From our docs:
So, the original purpose of this config setting is to limit all the folders inside the project to those that really need to be mutated. Now this is not the case. Please see here, I've pushed a test that works for
We already have a similar bug and fixed it for 0.16.2 - #1238 - but that one was about Explanation of the issue: In
So, given the following project structure:
and the following {
"source": {
"directories": [
"src/ToMutate"
]
}
} we should not mutate Hot to fix?I didn't have enough time to dig into the code yet, but I would say that the fix will be similar to |
Otherwise put, we have to find every file inside those source directories, and check against this list for every file we get from the coverage report. If a covered file isn't there, then we should skip it. True it is annoying, but not impossible. Files in source directories will act as a whitelist in this scheme. |
I see it exactly the same :) |
I think another usage in the wild is https://github.com/nelmio/alice, it currently does not work in 0.16 due to this (if you want to try it run |
Excludes should have been working, are they not? If not, that's a slightly different issue. |
Can be, I did not have the chance to investigate yet to know if it’s
exactly that issue or another edge case
…On Fri 15 May 2020 at 11:20, Alexey Kopytko ***@***.***> wrote:
Excludes should have been working, are they not?
If not, that's a slightly different issue.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1264 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHPVANIYRI5D2IELCMYOCTRRUCOVANCNFSM4MSKIN6A>
.
|
* Add test that passes for 0.15 but fails for 0.16 * Fixes #1264 * Use source files as a whitelist inside FilteredEnrichedTraceProvider * Move filtering OP earlier in the process * Fix autreview warnings in FilteredEnrichedTraceProvider * Simplify FilteredEnrichedTraceProvider * UncoveredTraceProvider * Refactor FilteredEnrichedTraceProvider into BufferedSourceFileFilter + UncoveredTraceProvider + UnionTraceProvider * Improve BufferedSourceFileFilter, fix PHPStan warnings * Factor out CoveredTraceProvider from UnionTraceProvider * UncoveredTraceProviderTest * CoveredTraceProviderTest * BufferedSourceFileFilterTest * UnionTraceProviderTest, removed FilteredEnrichedTraceProviderTest * Fix PHPStan warnings in tests * Fix remaining usages of FilteredEnrichedTraceProvider Co-authored-by: borNfreee <b0rn@list.ru>
Backport of infection#1269 * Fixes infection#1264 Co-authored-by: borNfreee <b0rn@list.ru>
Released https://github.com/infection/infection/releases/tag/0.16.4 Thank you for reporting and waiting for the fix ;) |
In order to run infection with 100% msi, we break our business logic into a "functional core" which can be thoroughly unit tested and kill every mutant. Then we run infection only over the functional core by using the
"--testsuite=unit"
test framework option and by usingsource.directories
ininfection.json.dist
. With version 0.15.* this works exactly as expected, with mutants only being applied to our functional core:With version 0.16.3, infection is mutating our entire codebase:
phpunit.xml
infection.json.dist
I tried stepping through with xdebug to track down the issue but got lost as so much has changed from 0.15 to 0.16. Happy to keep debugging if someone can help point me in the right direction?
The text was updated successfully, but these errors were encountered: