fix: stacktrace with nested with calls

This commit is contained in:
nuno maduro
2026-04-10 17:25:05 +01:00
parent bdf60cea91
commit 729f18a152
5 changed files with 349 additions and 4 deletions

View File

@ -74,7 +74,7 @@ final class DescribeCall
*/
public function __call(string $name, array $arguments): self
{
if (! $this->currentBeforeEachCall instanceof \Pest\PendingCalls\BeforeEachCall) {
if (! $this->currentBeforeEachCall instanceof BeforeEachCall) {
$this->currentBeforeEachCall = new BeforeEachCall(TestSuite::getInstance(), $this->filename);
$this->currentBeforeEachCall->describing = array_merge(

View File

@ -23,7 +23,9 @@ final class Backtrace
$current = null;
foreach (debug_backtrace(self::BACKTRACE_OPTIONS) as $trace) {
assert(array_key_exists(self::FILE, $trace));
if (array_key_exists(self::FILE, $trace) === false) {
break;
}
$traceFile = str_replace(DIRECTORY_SEPARATOR, '/', $trace[self::FILE]);