Skip to content

fix: popArgument drops duplicate arguments breaking --parallel --exclude-gropup=#1674

Open
flap152 wants to merge 3 commits into
pestphp:4.xfrom
flap152:fix/parallel-duplicate-args
Open

fix: popArgument drops duplicate arguments breaking --parallel --exclude-gropup=#1674
flap152 wants to merge 3 commits into
pestphp:4.xfrom
flap152:fix/parallel-duplicate-args

Conversation

@flap152
Copy link
Copy Markdown

@flap152 flap152 commented Apr 14, 2026

What:

  • Bug Fix

Description:

popArgument() in HandleArguments uses array_flip() twice, which silently
drops duplicate values. This breaks --parallel when multiple --exclude-group
flags are passed, since the parallel argument pipeline stores --exclude-group
and the group name as separate array entries (creating duplicate keys on flip).

The Coverage plugin had the same inline array_flip pattern.

Fix: Replace array_flip with array_search + unset in popArgument(),
and refactor Coverage to use the HandleArguments trait instead of inline logic.

Tests: Unit tests for popArgument() proving duplicate values are preserved.
Visual test for parallel with multiple --exclude-group flags.

Related:

Fixes #1437
Supersedes #1620, #1468

Copilot AI review requested due to automatic review settings April 14, 2026 18:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes argument handling in Pest plugins so duplicate argument values are not silently dropped (notably in --parallel scenarios with repeated --exclude-group), and adds coverage to prevent regressions.

Changes:

  • Reworked HandleArguments::popArgument() to remove an element via array_search + unset instead of array_flip (preserves duplicate values).
  • Refactored the Coverage plugin’s argument stripping to reuse the HandleArguments trait.
  • Added unit + visual tests for the duplicate-argument scenario and updated snapshots/expected counts accordingly.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Plugins/Concerns/HandleArguments.php Changes popArgument() implementation to avoid dropping duplicate values.
src/Plugins/Coverage.php Uses the shared HandleArguments trait to strip coverage-related CLI args safely.
tests/Unit/Plugins/Concerns/HandleArguments.php Adds unit tests proving duplicates are preserved.
tests/Visual/Parallel.php Adds a visual regression test for multiple --exclude-group under --parallel; updates expected output counts.
tests/.snapshots/success.txt Snapshot updates to include new tests and updated totals.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Plugins/Concerns/HandleArguments.php
Comment thread tests/Visual/Parallel.php
Comment thread tests/Visual/Parallel.php
@flap152 flap152 force-pushed the fix/parallel-duplicate-args branch from 6fb1c9d to 7904e42 Compare April 16, 2026 18:37
@flap152 flap152 force-pushed the fix/parallel-duplicate-args branch from 7904e42 to 520d86c Compare May 5, 2026 15:58
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.

[4.x] --parallel does not handle multiple --exclude-group flags

2 participants