pest icon indicating copy to clipboard operation
pest copied to clipboard

[Bug]: All Feature tests are marked as WARNING when the `.env` file is missing

Open josecl opened this issue 1 year ago • 2 comments

What Happened

In local enviroment is not a big deal, but in CI/CD is problematic because there are not FAILING tests and the problem is unnoticed.

   PASS  Tests\Unit\ExampleTest
  ✓ that true is true

   WARN  Tests\Feature\ExampleTest
  ! it returns a successful response → file_get_contents(/Users/jose/desa/laravel-11/.env): Failed to open stream: No such file or directory                                    0.07s

  Tests:    1 warning, 1 passed (2 assertions)
  Duration: 0.11s

How to Reproduce

  • Install a fresh Laravel 11
  • remove .env
  • update phpunit.xml adding APP_KEY, e.g. <env name="APP_KEY" value="base64:WYlqeJ/LNzXXke2rnMdo1cPWUk2yHAOPcz/qwJORJFM="/>
  • run pest

Sample Repository

No response

Pest Version

2.34.8, 3.1.0 and 3.2.3

PHP Version

8.2 and 8.3

Operation System

macOS

Notes

No response

josecl avatar Sep 25 '24 15:09 josecl

might be related to: https://github.com/pestphp/pest/issues/1028

OrbisK avatar Oct 02 '24 09:10 OrbisK

Workaround: touch .env as before_script

OrbisK avatar Oct 02 '24 09:10 OrbisK