Repository navigation
fix(mutation): say which files are never mutated, refuse mutants that die of a redeclaration - #142
Merged
Merged
Conversation
… die of a redeclaration A source file PHP includes before Pest serves mutants is never replaced. A run of the whole repository now lists those a test covers; its score is not corrected. A test bootstrap that loads the mutant of such a file anyway dies of the redeclaration, which counted every mutant of the file as caught: no score then. Closes #139
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #139.
The blind spot
A source file PHP includes before Pest puts its stream wrapper on
file(anautoload.filesentry and what it loads,tests/Pest.phpand what it loads) is never served mutated. The whole-repository canary only probed a file the harness writes itself, so a run said nothing of it. Reproduced with a real mutation run: a fully tested class loaded at startup read 50 %, all its mutants surviving.Reproducing it showed the opposite error too: with the test bootstrap the README gave (give
fileback, thenrequire PEST_MUTATION_FILE), the processes of such a file's mutants die ofCannot redeclare class, which Pest counts as caught. The same project, with a test asserting nothing about the class, read 100 % and the harness accepted it.Behaviour
Never mutated (N)), also bycheck --mutation-canary. Nothing is removed from the score.get_included_files()already lists.The list is read from the order of
get_included_files()in the canary process: what precedes pest-plugin-mutate'sStreamWrapper.php(or, when a bootstrap loads the mutant itself, what precedes the mutant).Cost
Whole-repository runs only: one more run of the canary test, plus one per listed file.
Not seen
A file included between the wrapper starting and a bootstrap giving
fileback is only listed when that bootstrap loads the mutant under a name of its own. A file a test includes again is listed although that later inclusion is mutated (the notice says so). A bootstrap that loads again an already included file without any declaration is not refused.