Skip to content

fix(sharding): strip --runner from the --list-tests sub-process - #2004

Open
apael wants to merge 3 commits into
pestphp:5.xfrom
apael:fix/shard-strip-runner
Open

apael wants to merge 3 commits into
pestphp:5.xfrom
apael:fix/shard-strip-runner

Conversation

@apael

@apael apael commented Oct 30, 2026

Copy link
Copy Markdown

Title: fix(sharding): strip --runner from the --list-tests sub-process

What:

  • Bug Fix
  • New Feature

Description:

php artisan test --parallel --shard=1/3 fails before running anything:

$ php artisan test -p --shard=1/3 tests/Unit

Symfony\Component\Process\Exception\ProcessFailedException

The command "'php' 'vendor/pestphp/pest/bin/pest' '--configuration=.../phpunit.xml'
'--runner=\Illuminate\Testing\ParallelRunner' 'tests/Unit' '--cache-directory'
'/tmp/__laravel_test_cache_directory' '--no-output' '--no-progress' '--list-tests'" failed.

Exit Code: 2(Misuse of shell builtins)

Unknown option "--runner". Most similar options are --filter, --stderr, --uses, --all, --columns

Without a shards.json, Shard discovers the test classes by re-running its own arguments with --list-tests. removeParallelArguments() takes out --parallel, -p and --processes, but Laravel's artisan test also passes --runner=\Illuminate\Testing\ParallelRunner in parallel mode. That argument reaches the sub-process, which does not run in parallel and so rejects it.

--runner is a parallel-only argument just as --processes is, so this strips it the same way. A unit test covers buildListTestsCommand() with Laravel's runner argument.

Related:

Same family as #1454 / #1731 / #1756 (--processes leaking into --list-tests).

@MrPunyapal MrPunyapal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also handle --runner Runner, alongside --runner=Runner? The current filter removes --runner but leaves its value in the list-tests command. I reproduced this locally. Please add a regression test for the space-separated form.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@apael

apael commented Oct 31, 2026

Copy link
Copy Markdown
Author

Thanks, good catch. --runner Runner now drops both the flag and its value (fb81069), and there is a regression test for the space-separated form; it fails without the change. The value is only consumed when it does not itself start with -, so a bare --runner followed by another option leaves that option alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants