Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Pest ignores '-c' option and only recognizes '--configuration' #1298

Open
panders23 opened this issue Oct 16, 2024 · 0 comments
Open
Labels

Comments

@panders23
Copy link

What Happened

When running Pest with the -c option (the short form of --configuration), Pest does not recognize it properly. Instead, it only handles the --configuration option, leading to unexpected behavior. After some debugging, I see that using -c an additional internal --configuration argument pointing to <project_root>/.pest.xml is generated. This internally added argument then overwrites the previous user-provided -c option in phpunit.

I investigated the issue and located the cause in the Pest codebase:

  • File: vendor/pestphp/pest/src/Plugins/Concerns/HandleArguments.php
  • Line: 20

Here, the code only checks for --configuration instead of both -c and --configuration. The arguments are obtained from:

  • File: vendor/pestphp/pest/src/Plugins/Configuration.php
  • Line: 37

How to Reproduce

  1. Use non default phpunit.xml file path
mv phpunit.xml phpunit.example.xml
  1. Run Pest with the -c option:
./vendor/bin/pest -c phpunit.example.xml --list-tests
  1. Observe that the specified configuration file is not properly loaded.

  2. Run Pest with the --configuration option:

./vendor/bin/pest --configuration phpunit.example.xml --list-tests
  1. Observe that the configuration file is loaded correctly.

Sample Repository

No response

Pest Version

3.3.2

PHP Version

8.3.12

Operation System

macOS

Notes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant