diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt index 39bd3f9e4..de896b1d3 100644 --- a/tests/.snapshots/success.txt +++ b/tests/.snapshots/success.txt @@ -2288,6 +2288,8 @@ ✓ parallel records the test run history ✓ parallel does not record the test run history when asked not to with ('--do-not-cache-result') ✓ parallel does not record the test run history when asked not to with ('--do-not-record-test-run-history') + ✓ parallel group-filtered run is not considered empty when a worker ends on a fully filtered file + ✓ parallel group-filtered run still fails when the selection matches no tests PASS Tests\Visual\ParallelNestedDatasets ✓ parallel loads nested datasets from nested directories @@ -2321,4 +2323,4 @@ ✓ pass with dataset with ('my-datas-set-value') ✓ within describe → pass with dataset with ('my-datas-set-value') - Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 37 skipped, 1648 passed (3649 assertions) \ No newline at end of file + Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 37 skipped, 1650 passed (3653 assertions) \ No newline at end of file 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 84f7336c6..3b5919264 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -105,3 +105,29 @@ '--do-not-cache-result', '--do-not-record-test-run-history', ])->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(removeAnsiEscapeSequences($process->getOutput()))->toContain('No tests found.') + ->and($process->getExitCode())->toBe(1); +})->skipOnWindows();