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.67k stars 360 forks source link

Unknown option "--parallel" when deploying #751

Closed chrispage1 closed 1 year ago

chrispage1 commented 1 year ago

Loving the pest project, it's really changing the way I test so thank you for that!

However, I've come across a bit of a strange issue. I have retrofitted PEST to a project that previously had a load of tests and have rewritten some. This works great and I can run ./vendor/bin/pest --parallel on my machine no problem.

However when pushing it up to a deployment pipeline, I get the below -

./vendor/bin/pest --parallel
<1s
+ ./vendor/bin/pest --parallel
   INFO  Unknown option "--parallel".

This worked perfectly when it was previously php artisan test --parallel. Any ideas why parallel seems to be an unknown option on my deployment pipeline? The tests are running within a php:8.2-fpm-alpine image.

Thanks, Chris.

chrispage1 commented 1 year ago

So to test this further, I've spun up a blank php:8.2-fpm-alpine image by running docker run -it -v "$(pwd)":/var/www:z php:8.2-fpm-alpine /bin/sh

Once inside, I've run ./vendor/bin/pest --parallel and it's run absolutely no problem, very strange... I don't suppose anyone else has come across this?

chrispage1 commented 1 year ago

After much debugging, I found the problem... before running pest, I was installing packages using composer as below:

composer install -o --no-interaction --no-plugins --no-scripts --ignore-platform-req=ext-*

The --no-plugins was preventing pest from setting up its own binary and was somehow deferring to PHPUnit. After removing this option from composer install, we're back and the full power of PEST is being utilised.

+ ./vendor/bin/pest --parallel --compact
  ............................................................................
  ............................................................................
  ............................................................................
  ............................................................................
  ............................................................................
  .....................................
  Tests:    409 passed (1014 assertions)
  Duration: 32.69s
  Parallel: 8 processes