From 4d9ed8768c7a8bd909af477407e6baa93f4c74d0 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 19 Aug 2024 02:24:18 +0100 Subject: [PATCH] fix: panic with `TestDescriptionMissing` --- src/Panic.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Panic.php b/src/Panic.php index 592634c0..37744aa2 100644 --- a/src/Panic.php +++ b/src/Panic.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Pest; use NunoMaduro\Collision\Writer; +use Pest\Exceptions\TestDescriptionMissing; use Pest\Support\Container; use Symfony\Component\Console\Output\ConsoleOutput; use Symfony\Component\Console\Output\OutputInterface; @@ -27,6 +28,10 @@ final class Panic */ public static function with(Throwable $throwable): never { + if ($throwable instanceof TestDescriptionMissing && ! is_null($previous = $throwable->getPrevious())) { + $throwable = $previous; + } + $panic = new self($throwable); $panic->handle();