Repository navigation
Conversation
The mutators applicable to a file were looked up in a map built from the default sets, so a mutator disabled in its set (NotEmptyStringToEmpty) never mutated anything, even when requested with --mutator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Author
|
For context: this is the first part of a fix for enum case values, which are never mutation-tested. The whole plan is described in pestphp/pest#1978. |
1 of 2 tasks
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.
What:
Description:
A mutator that is not part of a default set never creates a mutation, even when it is requested explicitly. For example,
pest --mutate --mutator=StringNotEmptyStringToEmpty(or->mutator(Mutators::STRING_NOT_EMPTY_STRING_TO_EMPTY)) reports0 Mutations for 0 Files createdon code full of non-empty strings.MutationGenerator::filterMutators()keeps only the requested mutators found inMutatorMap, andMutatorMapis built from the default sets.NotEmptyStringToEmptyis commented out inStringSet, so it is never in the map, and the requested mutator is silently dropped.The fix.
filterMutators()keeps each requested mutator whosenodesToHandle()contains a node type of the file. That is the same check the map performed, but it no longer depends on the default sets. The default sets are unchanged, so nothing changes for users who do not request such a mutator.After this change
MutatorMapis no longer used by the plugin. I left it in place because it is a public class; I am happy to remove it in this PR if you prefer.Tests.
it generates mutations of a mutator requested outside the default setsintests/Unit/MutationGeneratorTest.phpgenerates one mutation withNotEmptyStringToEmpty; without the fix it generates none.CI. The workflows ran on a fork with the full matrix and
fail-fast: false.COMPOSER_ROOT_VERSION=5.x-devwas set there only because Composer cannot guess the root version of a feature branch. The results were compared, job by job, with the same workflows on unmodified5.x(d0c8711):5.x: Tests, Static AnalysisThe set of failures is identical in every job:
Tests\Visual\*snapshots fail in theprefer-stablejobs, because current PHPUnit prints a deprecation warning for thecacheResultattribute ofphpunit.xml;Everything else passes.
🤖 Generated with Claude Code