For some reason I always get this error when I try to run Pest tests in PhpStorm:
/usr/local/bin/php ~/project/vendor/pestphp/pest/bin/pest --teamcity --configuration ~/project/phpunit.xml ~/project/tests/Feature/SampleTest.php
Pest 1.20.0
Pest\Exceptions\ShouldNotHappen
This should not happen - please create an new issue here: https://github.com/pestphp/pest.
- Issue: Test file not found.
- PHP version: 8.1.0RC5-dev
- Operating system: Darwin
at pestphp/pest/src/Exceptions/ShouldNotHappen.php:38
34▕ * Creates a new instance of should not happen without a specific exception.
35▕ */
36▕ public static function fromMessage(string $message): ShouldNotHappen
37▕ {
➜ 38▕ return new ShouldNotHappen(new Exception($message));
39▕ }
40▕ }
41▕
+3 vendor frames
4 tests/Feature/SampleTest.php:38
it("it validates the form", Object(Closure))
- OS: macOS Monterey (but I had the same problem in Big Sur, too)
- PhpStorm: 2021.2.2
- Pest plugin: 1.2.1 (same bug since previous versions, but not sure which one exactly)
- PHP: 8.1.0RC5-dev (same bug since 8.0)
This exact command /usr/local/bin/php ~/project/vendor/pestphp/pest/bin/pest --teamcity --configuration ~/project/phpunit.xml ~/project/tests/Feature/SampleTest.php
works perfectly when I run it directly from the Terminal, but never from PhpStorm.
Here's my Pest plugin configuration in PhpStorm:
PS: all ~/ paths are replacing real absolute paths. PPS: this plugin did work last year, right after the first public release of PestPHP. I wonder what went wrong (on my side, I guess).