出于某种原因,当我尝试在 PhpStorm 中运行 Pest 测试时,我总是会收到此错误:
/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))
- 操作系统:macOS Monterey(但我在 Big Sur 也遇到了同样的问题)
- PhpStorm:2021.2.2
- Pest 插件:1.2.1(与以前版本相同的错误,但不确定究竟是哪一个)
- PHP:8.1.0RC5-dev(自 8.0 以来的相同错误)
这个确切的命令/usr/local/bin/php ~/project/vendor/pestphp/pest/bin/pest --teamcity --configuration ~/project/phpunit.xml ~/project/tests/Feature/SampleTest.php
在我直接从终端运行它时完美运行,但从不从 PhpStorm 运行。
这是我在 PhpStorm 中的 Pest 插件配置:
PS:所有 ~/ 路径正在替换真正的绝对路径。PPS:这个插件在去年第一次公开发布 PestPHP 之后确实有效。我想知道出了什么问题(我猜是在我这边)。