Skip to content

test: cover parallel group-filtered runs whose workers end on fully filtered files - #1985

Open
User7142 wants to merge 1 commit into
pestphp:5.xfrom
User7142:test/parallel-group-filtered-last-file
Open

User7142 wants to merge 1 commit into
pestphp:5.xfrom
User7142:test/parallel-group-filtered-last-file

Conversation

@User7142

Copy link
Copy Markdown

What:

  • Bug Fix
  • New Feature

Description:

Follow-up to #1757, retargeted to 5.x as requested.

The fix itself already landed on 5.x in 942d6ae (WrapperRunner::numberOfTestsSeenByWorker()), so this PR only adds the regression tests:

  • Worker ends on a fully filtered file: with --processes=1 --group=filtered the single worker deterministically ends on ZTest.php, whose only test is outside the group. A worker's serialized TestResult only carries the numberOfTests of its last file, so without the fix the merged result claims the suite was empty and the run exits 1 despite a green summary. The test asserts exit code 0. It fails when numberOfTestsSeenByWorker() is reverted to ResultReflection::numberOfTests($result).
  • Genuinely empty selection: --group=missing must still exit non-zero, so the fix cannot mask real "0 tests" runs.

Fixtures live in tests/Fixtures/Suites/ParallelGroupFilteredLastFile, which is already excluded from the main suite.

Related:

…iltered files

A worker's serialized TestResult only carries the `numberOfTests` of the
last file it executed. When that file has all of its tests excluded by
`--group`/`--exclude-group`, the merged result used to claim the suite was
empty and the run exited 1 despite a green summary (PHPUnit enables
`failOnEmptyTestSuite` implicitly for explicit test selections).

942d6ae fixed this in `WrapperRunner::numberOfTestsSeenByWorker()`; these
tests pin the behaviour:

- with `--processes=1` the single worker deterministically ends on
  ZTest.php, whose only test is outside the filtered group, so the run
  must exit 0 (fails when the fix is reverted)
- a selection that matches no tests at all must still exit non-zero

Refs pestphp#1483
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.

1 participant