more tests

This commit is contained in:
nuno maduro
2026-08-06 16:35:03 +01:00
parent 4d3d0105b7
commit a40cc6bc0e
5 changed files with 112 additions and 12 deletions
@@ -75,6 +75,40 @@ test('filtered mode finds nothing to do on a clean green feature branch', functi
->and($delta->isHardSuppressed())->toBeTrue($delta->summary());
})->skipOnWindows();
test('filtered mode falls back to a full replay when a cached failure cannot be located', function (): void {
$project = Project::make('master');
$project->seed('master', failing: ['adds two numbers']);
$project->mutateGraph(function (array $graph): array {
$testId = Project::testId('tests/Unit/CalculatorTest.php', 'adds two numbers');
$graph['baselines']['master']['results'][$testId]['file'] = 'tests/Unit/DeletedTest.php';
return $graph;
});
$project->git()->switchTo('feature-x', new: true);
$result = $project->pest('--tia', '--filtered');
expect($result->output)->toContain('Some cached tests due a re-run could not be located on disk.')
->and($result->output)->toContain('Running the full suite with replay instead of a filtered run.')
->and($result->output)->not->toContain('No affected tests found');
})->skipOnWindows();
test('filtered mode finds nothing to do on the default branch itself', function (): void {
$project = Project::make('master');
$project->seed('master');
$result = $project->pest('--tia', '--filtered');
$delta = $project->delta();
expect($result->output)->toContain('No affected tests found')
->and($result->exitCode)->toBe(0, $result->describe())
->and($delta->isHardSuppressed())->toBeTrue($delta->summary());
})->skipOnWindows();
test('a detached HEAD replays without minting a branch key', function (): void {
$project = Project::make('master');
$project->seed('master');