Repository navigation
test: run isolated tests in the process of a mutant - #722
Merged
Merged
Conversation
PHPUnit runs tests/bootstrap.php again in each process it isolates a test in (RunTestsInSeparateProcesses). That process inherits PEST_MUTATION_TESTING but Pest never started its stream wrapper there, so giving `file` back raised "file:// was never changed, nothing to restore" and failed every test of BootstrapEnvironmentTest, on unchanged code too: every mutant those tests cover counted as killed. The wrapper is now given back only when it is on `file`. The mutated source is still loaded in both processes.
ogorzalka
enabled auto-merge
November 27, 2026 15:25
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
BootstrapEnvironmentTestfailed on unchanged code when run the way Pest runs a mutant, so every mutant it covers counted as killed without being tested.Cause
It uses
RunTestsInSeparateProcesses. Each child runstests/bootstrap.phpagain and inheritsPEST_MUTATION_TESTING, but Pest's stream wrapper is not onfilethere, andStreamWrapper::disable()raisedfile:// was never changed, nothing to restore.Fix
Give
fileback only when Pest's wrapper is actually on it. The mutated source is still loaded in both processes. Tests only: no CHANGELOG entry.What this proves, and what it does not
Bootstrap.phpfails exactly the 3 cases that assert it inside the isolated children, and an exact copy passes; everycomposer qagate that ran locally passed (4011 tests, 1 skipped).autoload.filesstill cannot be replaced by a mutant.An upcoming harness release refuses mutation scores when tests fail on unchanged code: this has to be merged before the framework moves to it.