diff --git a/src/Plugins/Tia/ResultCollector.php b/src/Plugins/Tia/ResultCollector.php index 68e40b8d..55b886fa 100644 --- a/src/Plugins/Tia/ResultCollector.php +++ b/src/Plugins/Tia/ResultCollector.php @@ -100,11 +100,7 @@ final class ResultCollector public function testRisky(string $message): void { - if ($this->currentTestId === null) { - return; - } - - $this->record(TestStatus::risky($message)); + $this->recordIssue(TestStatus::risky($message)); } /** diff --git a/tests/Features/Tia/IssueStatuses.php b/tests/Features/Tia/IssueStatuses.php index b6baf3d1..2e90b959 100644 --- a/tests/Features/Tia/IssueStatuses.php +++ b/tests/Features/Tia/IssueStatuses.php @@ -103,6 +103,29 @@ test('a failure outranks an issue triggered on the way to it', function (): void ->and($project->graph()['baselines']['master']['results'][$id]['status'])->toBe(7); })->skipOnWindows(); +test('a failure outranks the test also being risky', function (): void { + $project = Project::make('master'); + $project->seed('master'); + + $project->write('tests/Unit/CalculatorTest.php', str_replace( + 'toBe(3)', + 'toBe(999)', + tiaTriggering('set_error_handler(fn (): bool => false);'), + )); + $project->git()->commit('a failure in a risky test'); + + $result = $project->pest('--tia'); + + $id = Project::testId('tests/Unit/CalculatorTest.php', 'adds two numbers'); + + expect($result->exitCode)->not->toBe(0) + ->and($project->graph()['baselines']['master']['results'][$id]['status'])->toBe(7); + + $result = $project->pest('--tia'); + + expect($result->exitCode)->not->toBe(0, $result->describe()); +})->skipOnWindows(); + test('a skip outranks an issue triggered on the way to it', function (): void { $project = Project::make('master'); $project->seed('master');