Skip to content

[Bug]: Using --parallel causes overall process to fail with no reporting as to why even though all tests pass #1483

Description

@ConorEdwardsCP

What Happened

Our team noticed after upgrading to Pest 4 that our tests running in parallel are showing all tests as passing, but having the overall command fail. However, if we run the exact same test suite sequentially, we get the same number of passing tests and the overall command passes.

Sequential

./vendor/bin/pest --exclude-group=fails-in-parallel  --testsuite=Feature --compact

  ................................................................................................................................................................
  ............................................................................

  Tests:    236 passed (364 assertions)
  Duration: 139.51s

echo $?
0

Parallel

./vendor/bin/pest --exclude-group=fails-in-parallel  --testsuite=Feature --parallel

  ................................................................................................................................................................
  ............................................................................

  Tests:    236 passed (364 assertions)
  Duration: 30.20s
  Parallel: 12 processes

echo $?
2

How to Reproduce

  1. Run test suite without --parallel flag and see it passes with the same number of tests and assertions
  2. Run test suite with --parallel flag and see it returns an error code of 2, even though it shows the same number of tests and assertions passing successfully

Sample Repository

No response

Pest Version

4.0.3

PHP Version

8.4.11

Operation System

macOS

Notes

I'm not certain if it's related, but I've also noticed that when we run tests in parallel now and there is a test failure, it is swallowing the error and immediately killing the tests without reporting anything about what caused the failure. There was a previous issue #1451 that hinted at their problem could be related to the master process not properly handling the exit codes of the worker threads, which feels like it could be a reason for both of these issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions