Repository navigation
fix: don't warn from Trace::cleanup() when there is no traces directory to remove - #278
Open
joshdaugherty wants to merge 1 commit into
Open
joshdaugherty wants to merge 1 commit into
joshdaugherty wants to merge 1 commit into
Conversation
This was referenced Oct 1, 2026
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.
Fixes pestphp/pest#1944.
What happens
Trace::cleanup(), added in v5.1.0, runs once per run whether or not--tracewas passed, and ends with@rmdir(self::dir()). Whentests/Browser/Tracesdoes not exist,rmdir()raises a warning, and it does the same for a directory that holds anything other than*.zip. The@hides the message, but PHPUnit still records it at test-runner level, asTest Runner Triggered PHP Warning (suppressed using operator). A suite withfailOnWarning="true"then exits 1 with every test passing, and nothing in the output says why.The change
cleanup()removes the directory only when it exists and is empty, sormdir()has nothing to warn about and the@is no longer needed. The*.zipremoval above it is unchanged.Checks
Against a Laravel package's browser suite of 254 passing tests with
failOnWarning="true"(macOS, PHP 8.5.8, Pest 5.2.1, PHPUnit 13.3.4), with this change applied to the installed v5.1.0:Trace.phptests/Browser/Tracesbefore the runIn this repository: Pint, Rector, PHPStan and type coverage pass. The full suite gives the same result on
5.xand on this branch: 370 passed and the same 3 failed both times, all three of which load external pages (it may visit external URLsand the two iframe tests). No test is added:TracingTestwrites into the same directory, and under--parallela test removing or populating it would race that test.