Repository navigation
fix(mutation): give no score when the tests fail on unchanged code run as a mutant - #137
Merged
Merged
Conversation
added 4 commits
November 27, 2026 14:20
…n as a mutant Pest counts a mutant's process that fails as a caught mutant, and one that loops as a timeout, caught too. Before Pest runs, run the tests covering the code with PEST_MUTATION_FILE an exact copy of PEST_MUTATION_TESTING, as Pest runs a mutant, and refuse the score when they do not pass. Add check --mutation-canary to ask only that question.
What a failing or killed run leaves in the shared temporary directory made the next control fail for a reason that was not its own. Say too that the file named for the whole repository only stands for the others.
The tests selected as a mutant are now named one by one (in several runs when the filter is too long for PCRE), never by whole class: a test that covers nothing is run for no mutant, and could refuse a healthy repository. --parallel is never passed to those runs, as Pest passes it to no mutant. The control takes its coverage in parallel when a single process fails, and a failing run is tried once more, so that one flaky test does not refuse a score.
…ory ran out, condition the advice pest-plugin-mutate 3 leaves --coverage-php among the arguments of a mutant (version 4 removes it): the runs as a mutant now collect coverage too when the installed version does. A canary run that exhausted its memory says so, and that a -d flag of the command does not reach it. The advice to give file back now says to do it only when the wrapper of Pest is on it, with the code: done unconditionally it fails every test PHPUnit isolates in a process of its own.
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.
Problem
Pest counts a mutant's process that fails as a caught mutant, and one that loops as a timeout, also caught. A suite that breaks in that process whatever the file contains therefore scores mutants nothing tested. Measured on pollora/media: 96.95 % reported, about 86 % once its mutants really ran.
Change
Before Pest runs, the harness runs the tests covering the code with
PEST_MUTATION_FILEset to an exact copy of the source, the way a mutant is launched, and refuses the score when they fail or run past the limit.check --mutation-canaryasks only this question.Before releasing
Repositories that passed may now be refused, rightly. Each needs its suite fixed before moving to the release carrying this (usually the Patchwork fix, antecedent/patchwork#235; the framework needs Pollora/framework#722).
What this proves, and what it does not
filesentry is not detected; Semgrep did not run locally.