Conversation
… the checkout `Backtrace::backtrace()` skipped a frame when its path held `pest/src`, so a checkout of this repository in a directory with any other name, such as `pest5`, returned `src/Support/Backtrace.php` as the file of the caller and `tests/Unit/Support/Backtrace.php` failed. The frame check now compares against the directory that holds this file, which is the same directory whether Pest runs from its own checkout or from `vendor/pestphp/pest`, and the global that marked the internal test suite has no reader left. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 happens
Backtrace::backtrace()decides which frames belong to Pest itself by looking for a substring in the path of each frame:pest/srcwhen Pest runs its own test suite, and/pestphp/pest/srcwhen it runs fromvendor.Clone this repository into a directory with any other name,
pest5for example, and run the unit suite:The path
pest5/src/Support/Backtrace.phpdoes not containpest/src, so the first frame is not skipped andBacktrace::file()returns its own file instead of the file of the caller. The same happens for any checkout name, a fork, a worktree, or a CI job that clones into a directory named after the branch.The fix
Compare each frame against the directory that holds
Backtrace.phpinstead of a name:dirname(__DIR__)is thesrcdirectory of Pest in every layout: the checkout of this repository, whatever it is called, andvendor/pestphp/pest/srcin a project that installs Pest. One check replaces the two substring checks.$GLOBALS['__PEST_INTERNAL_TEST_SUITE']existed to enable the first substring check during the internal suite. Nothing reads it now, sotests/Pest.phpno longer sets it.Verification
tests/Unit/Support/Backtrace.phppasses from a checkout namedpest5.pest --exclude-group=integration: 1582 passed, 0 failed.🤖 Generated with Claude Code