Reject the parallel short flag during retry (#2043)

Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
This commit is contained in:
Ikki Nishihara
2026-11-20 18:42:02 +09:00
committed by GitHub
parent fabc818ba9
commit f80b3a89a0
4 changed files with 13 additions and 3 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ final class Retry implements HandlesArguments
return $arguments;
}
if ($this->hasArgument('--parallel', $arguments)) {
if ($this->hasArgument('--parallel', $arguments) || in_array('-p', $arguments, true)) {
throw new InvalidOption('The [--retry] option is not supported when running in parallel.');
}
+3 -1
View File
@@ -1870,6 +1870,8 @@
PASS Tests\Unit\Plugins\Retry
✓ it orders by defects and stop on defects if when --retry is used
✓ it rejects retry with a parallel flag with ('--parallel')
✓ it rejects retry with a parallel flag with ('-p')
PASS Tests\Unit\Plugins\Shard
✓ getShard → it parses valid shard format with ('1/2', 1, 2)
@@ -2562,4 +2564,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, 38 skipped, 1856 passed (4269 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 40 todos, 38 skipped, 1858 passed (4273 assertions)
+8
View File
@@ -1,5 +1,6 @@
<?php
use Pest\Exceptions\InvalidOption;
use Pest\Plugins\Retry;
it('orders by defects and stop on defects if when --retry is used ', function (): void {
@@ -12,3 +13,10 @@ it('orders by defects and stop on defects if when --retry is used ', function ()
'--stop-on-failure',
]);
});
it('rejects retry with a parallel flag', function (string $parallelFlag): void {
(new Retry)->handleArguments(['--retry', $parallelFlag]);
})->with(['--parallel', '-p'])->throws(
InvalidOption::class,
'The [--retry] option is not supported when running in parallel.',
);
+1 -1
View File
@@ -21,7 +21,7 @@ test('parallel', function () use ($run): void {
$output = implode("\n", array_slice(explode("\n", (string) $output), -10));
$profileOutput = $run('tests/Fixtures/Suites/SuccessOnly.php', '--profile');
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 30 skipped, 1734 passed (3752 assertions)';
$expected = '2 deprecated, 4 warnings, 5 incomplete, 3 notices, 40 todos, 30 skipped, 1736 passed (3756 assertions)';
expect($output)
->toContain("Tests: {$expected}")