From 9731ded6af6e6e795887c1758a8d5d01dc86c325 Mon Sep 17 00:00:00 2001 From: Youssef Mansour Date: Tue, 19 May 2026 01:16:50 +0300 Subject: [PATCH 1/3] fix: support tests outside Tests\ namespace in sharding --- src/Plugins/Shard.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugins/Shard.php b/src/Plugins/Shard.php index 814125f20..32fd68f1a 100644 --- a/src/Plugins/Shard.php +++ b/src/Plugins/Shard.php @@ -193,7 +193,7 @@ private function allTests(array $arguments): array '--list-tests', ]))->setTimeout(120)->mustRun()->getOutput(); - preg_match_all('/ - (?:P\\\\)?(Tests\\\\[^:]+)::/', $output, $matches); + preg_match_all('/ - (?:P\\\\)?(.+?)::/', $output, $matches); return array_values(array_unique($matches[1])); } From 24d2bf907b1f6bc42635e3b5d7387409bec7096b Mon Sep 17 00:00:00 2001 From: Youssef Mansour Date: Tue, 19 May 2026 11:18:42 +0300 Subject: [PATCH 2/3] chore: remove pest-plugin-browser from dev dependencies for local testing --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 09b9a31ff..5798f8471 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,6 @@ "require-dev": { "mrpunyapal/peststan": "^0.2.10", "pestphp/pest-dev-tools": "^4.1.0", - "pestphp/pest-plugin-browser": "^4.3.1", "pestphp/pest-plugin-type-coverage": "^4.0.4", "psy/psysh": "^0.12.22" }, From 7e798a13ccf27e0df13ec9330339b2d243e2cec4 Mon Sep 17 00:00:00 2001 From: YoussefMansour9 Date: Tue, 2 Jun 2026 04:19:45 +0300 Subject: [PATCH 3/3] fix: handle AfterLastTestMethodErrored in StateGenerator to prevent TypeError in parallel mode When running tests in parallel mode (--parallel), testErroredEvents() can return AfterLastTestMethodErrored events. The existing code assumed all non-Errored events were BeforeFirstTestMethodErrored, causing a TypeError when an AfterLastTestMethodErrored event was passed to fromBeforeFirstTestMethodErrored(). The fix adds an explicit instanceof check for BeforeFirstTestMethodErrored instead of the catch-all else, allowing AfterLastTestMethodErrored events to be safely skipped. Fixes #1623 --- src/Support/StateGenerator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Support/StateGenerator.php b/src/Support/StateGenerator.php index f9b32d604..d72c556ec 100644 --- a/src/Support/StateGenerator.php +++ b/src/Support/StateGenerator.php @@ -10,6 +10,7 @@ use PHPUnit\Event\Code\TestDoxBuilder; use PHPUnit\Event\Code\TestMethod; use PHPUnit\Event\Code\ThrowableBuilder; +use PHPUnit\Event\Test\BeforeFirstTestMethodErrored; use PHPUnit\Event\Test\Errored; use PHPUnit\Event\Test\Failed; use PHPUnit\Event\Test\PhpunitDeprecationTriggered; @@ -34,8 +35,7 @@ public function fromPhpUnitTestResult(int $passedTests, PHPUnitTestResult $testR TestResult::FAIL, $testResultEvent->throwable() )); - } else { - // @phpstan-ignore-next-line + } elseif ($testResultEvent instanceof BeforeFirstTestMethodErrored) { $state->add(TestResult::fromBeforeFirstTestMethodErrored($testResultEvent)); } }