From 887bed3d450025753f96fd150a106d681fa65503 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 25 Jan 2024 15:00:04 +0000 Subject: [PATCH] fix: adjusts backtrace for pest's internal test suite --- src/Support/Backtrace.php | 4 ++++ tests/Pest.php | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/Support/Backtrace.php b/src/Support/Backtrace.php index f08ecd6e..03001976 100644 --- a/src/Support/Backtrace.php +++ b/src/Support/Backtrace.php @@ -115,6 +115,10 @@ final class Backtrace continue; } + if (($GLOBALS['__PEST_INTERNAL_TEST_SUITE'] ?? false) && str_contains($trace['file'], 'pest'.DIRECTORY_SEPARATOR.'src')) { + continue; + } + if (str_contains($trace['file'], DIRECTORY_SEPARATOR.'pestphp'.DIRECTORY_SEPARATOR.'pest'.DIRECTORY_SEPARATOR.'src')) { continue; } diff --git a/tests/Pest.php b/tests/Pest.php index 4499f0a5..6f40b03e 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -3,6 +3,8 @@ use Tests\CustomTestCase\CustomTestCase; use Tests\CustomTestCaseInSubFolders\SubFolder\SubFolder\CustomTestCaseInSubFolder; +$GLOBALS['__PEST_INTERNAL_TEST_SUITE'] = true; + uses(CustomTestCaseInSubFolder::class)->in('PHPUnit/CustomTestCaseInSubFolders/SubFolder/SubFolder'); // test case for all the directories inside PHPUnit/GlobPatternTests/SubFolder/