Skip to content

fix: strip --processes from --list-tests when sharding in parallel - #1741

Open
lazerg wants to merge 1 commit into
pestphp:4.xfrom
lazerg:fix/issue-1731-shard-parallel-processes
Open

fix: strip --processes from --list-tests when sharding in parallel#1741
lazerg wants to merge 1 commit into
pestphp:4.xfrom
lazerg:fix/issue-1731-shard-parallel-processes

Conversation

@lazerg

@lazerg lazerg commented Jun 26, 2026

Copy link
Copy Markdown

What:

  • Bug Fix

Description:

When --shard is used with --parallel and there's no usable tests/.pest/shards.json, Pest builds the shard's --filter by spawning an internal --list-tests run. Shard::removeParallelArguments() only stripped --parallel/-p from that sub-process, so it still received --processes, which --list-tests rejects — mustRun() then threw ProcessFailedException and the whole run exited non-zero even though every test passed. This strips --processes from that sub-invocation too, alongside the existing --parallel removal.

Related:

Closes #1731 (same root cause as #1454).

@lazerg lazerg changed the title fix: strip --processes from --list-tests when sharding in parallel fix: strip --processes from --list-tests when sharding in parallel Jul 15, 2026
@lazerg

lazerg commented Jul 29, 2026

Copy link
Copy Markdown
Author

@nunomaduro this fixes a real crash when --shard and --parallel are combined, would you mind taking a look when you get a chance?

devajmeireles added a commit to tallstackui/tallstackui that referenced this pull request Jul 29, 2026
…orker

Two separate problems kept the sharded pipeline red even though every test
passed.

The shard builds its own --filter internally to select the files for its
slice, so passing --filter Browser alongside it gave PHPUnit two of them.
It warns "Option --filter cannot be used more than once" and exits 1 while
still running everything. Switching to --testsuite, which phpunit.xml
already defines for both suites, avoids the collision: same tests, exit 0.

This is the same family as pestphp/pest#1731 and #1454, where the shard's
internal --list-tests sub-invocation also flips the exit code, but the fix
in pestphp/pest#1741 only strips --processes and would not cover this.

Separately, Alert\FeatureTest failed intermittently with "filemtime(): stat
failed" on a compiled view. Parallel workers share one compiled-view
directory, so a worker can delete a view while another stats it. Paratest
gives each worker a TEST_TOKEN, so each now compiles into its own directory.
Four consecutive parallel runs went green afterwards.

The previous run showed the sharding itself already works: 136+139+127+169
adds up to the full 571 tests, with wall time down from about 14 minutes to
roughly 5m30 (the slowest slice).
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.

[Bug]: --shard + --parallel exits 1 when shards.json is missing/incomplete (count-based fallback)

1 participant