pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.12k stars 319 forks source link

[Bug]: tests with `--parallel` flag fails starting from PEST 2.29.1 #1053

Closed eleftrik closed 5 months ago

eleftrik commented 6 months ago

What Happened

I have a Laravel 10.39.0 application with ~1000 tests. Until PEST 2.29.0, everything runs smoothly: tests are always passing.

Starting from PEST 2.29.1 (even with 2.30.0 version), I got a strange behavior:

In WorkerCrashedException.php line 41:

  The test "PARATEST='1' TEST_TOKEN='4' UNIQUE_TEST_TOKEN='4_6595627841337' /Users/..../myproject/tests/Feature/SomeFolder/SomeTest.php" failed.

  Exit Code: 0(OK)

  Working directory: /Users/....../myproject

  Output:
  ================

  Error Output:
  ================

(no other details are provided)

If I mark every test inside SomeTest.php file with ->todo();, such an error still occurs. If I delete SomeTest.php, such an error still occurs, on the next test file inside SomeFolder.

For the moment, I've fixed version 2.29.0 in my composer.json to bypass the error.

Please let me know if I can provide you with other details. Thank you

How to Reproduce

XDEBUG_MODE=off ./vendor/bin/pest --parallel --bail --colors=always to run the whole suite

Sample Repository

No response

Pest Version

2.29.1

PHP Version

8.2.14

Operation System

macOS

Notes

No response

Rydgel commented 6 months ago

I have the same problem. With the same PHP version as well. Same behaviors, the tests in itself runs fine, and if I remove the test suite where this error occurs, it moves to the next file.

eleftrik commented 6 months ago

@Rydgel Did you try to downgrade PEST to 2.29.0 version? Up now, this is the only temporary fix I have been able to find.

Rydgel commented 6 months ago

@eleftrik I did downgrade and it fixed my issue 👍

eleftrik commented 6 months ago

@Rydgel I'm glad it worked.

I would like to understand why this error is happening, but I'm missing some debugging skills related to PHPUnit / PEST. Is there anyone who can help me? Thanks.

Rydgel commented 6 months ago

It seems related to PHPUnit update

https://github.com/pestphp/pest/compare/v2.29.0...v2.29.1

calebdw commented 6 months ago

This has happened to me as well but only with xdebug enabled, no failures happen when removing the zend_extension=xdebug.so from the ini files

Edit: the exit code I am getting is 137 and could be due to an OOM error instead of the same issue the OP is experiencing

eleftrik commented 5 months ago

Currently, I'm using Pest 2.32.2 and this error has disappeared.

devajmeireles commented 5 months ago

Thanks for your feedback, @eleftrik !

Make sure to upgrade your PestPHP to the latest version to fix this issue.

Rydgel commented 5 months ago

@eleftrik it was fixed by https://github.com/sebastianbergmann/phpunit/issues/5662

eleftrik commented 5 months ago

@eleftrik it was fixed by sebastianbergmann/phpunit#5662

Thanks!