From 2e58918201f047cd9179e8944faa6dc478513815 Mon Sep 17 00:00:00 2001 From: Lazizbek Ergashev Date: Thu, 13 Aug 2026 20:15:45 +0500 Subject: [PATCH] fix(tia): treat a test skipped from a hook as finished (#1863) --- src/Plugins/Tia/ResultCollector.php | 2 +- tests/Features/Tia/CompleteRunWriteTier.php | 28 +++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Plugins/Tia/ResultCollector.php b/src/Plugins/Tia/ResultCollector.php index 48f47d85..68e40b8d 100644 --- a/src/Plugins/Tia/ResultCollector.php +++ b/src/Plugins/Tia/ResultCollector.php @@ -117,7 +117,7 @@ final class ResultCollector public function hasUnfinishedTest(): bool { - return $this->currentTestId !== null; + return $this->currentTestId !== null && ! isset($this->results[$this->currentTestId]); } public function recordAssertions(string $testId, int $assertions): void diff --git a/tests/Features/Tia/CompleteRunWriteTier.php b/tests/Features/Tia/CompleteRunWriteTier.php index 73f21433..039a282a 100644 --- a/tests/Features/Tia/CompleteRunWriteTier.php +++ b/tests/Features/Tia/CompleteRunWriteTier.php @@ -33,6 +33,34 @@ test('a complete run prunes a deleted test', function (array $arguments): void { ->and($delta->structureMoved())->toBeFalse($delta->summary()); })->with(Project::SEQUENTIAL_AND_PARALLEL)->skipOnWindows(); +test('a complete run stays complete when the last test is skipped from a hook', function (array $arguments): void { + $project = Project::make('master'); + $project->seed('master'); + + $project->write('tests/Unit/GreeterTest.php', <<<'PHP' + markTestSkipped('not today'); + }); + + test('greets a person', function (): void { + expect((new Greeter)->greet('Nuno'))->toBe('Hello, Nuno!'); + }); + PHP); + + $result = $project->pest(...$arguments); + $delta = $project->delta(); + + expect($result->tally())->toContain('1 skipped') + ->and($delta->removed())->toBe(1, $delta->summary()) + ->and($delta->added())->toBe(0, $delta->summary()); +})->with(Project::SEQUENTIAL_AND_PARALLEL)->skipOnWindows(); + test('a complete run records nothing for a test file the graph does not know', function (): void { $project = Project::make('master'); $project->seed('master');