diff --git a/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ATest.php b/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ATest.php new file mode 100644 index 000000000..16b1f5b3f --- /dev/null +++ b/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ATest.php @@ -0,0 +1,5 @@ +toBeTrue(); +})->group('filtered'); diff --git a/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ZTest.php b/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ZTest.php new file mode 100644 index 000000000..126c80243 --- /dev/null +++ b/tests/Fixtures/Suites/ParallelGroupFilteredLastFile/ZTest.php @@ -0,0 +1,5 @@ +toBeTrue(); +}); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index a775c9926..ada2fa1ce 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -56,3 +56,28 @@ ->toContain('Tests: 2 passed (2 assertions)') ->toContain('Parallel: 3 processes'); })->skipOnWindows(); + +test('parallel group-filtered run is not considered empty when a worker ends on a fully filtered file', function (): void { + $process = new Process( + ['php', 'bin/pest', '--parallel', '--processes=1', '--group=filtered', 'tests/Fixtures/Suites/ParallelGroupFilteredLastFile'], + dirname(__DIR__, 2), + ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'], + ); + + $process->run(); + + expect(removeAnsiEscapeSequences($process->getOutput()))->toContain('Tests: 1 passed (1 assertions)') + ->and($process->getExitCode())->toBe(0); +})->skipOnWindows(); + +test('parallel group-filtered run still fails when the selection matches no tests', function (): void { + $process = new Process( + ['php', 'bin/pest', '--parallel', '--processes=3', '--group=missing', 'tests/Fixtures/Suites/ParallelGroupFilteredLastFile'], + dirname(__DIR__, 2), + ['COLLISION_PRINTER' => 'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true', 'PAO_DISABLE' => '1'], + ); + + $process->run(); + + expect($process->getExitCode())->not->toBe(0); +})->skipOnWindows();