You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Linux under Docker (base image : ubuntu:22.04)
Xdebug enabled.
Versions
PHP : 8.3.17 Pest : 3.7.4 Collision : 8.6.1
What Happened
Short story
When a TypeError is thrown inside the afterAll hook, nothing is displayed but the process return as well as expected the error code 2. We cannot determine the error caused since no message is displayed.
Long story
My repository is private, but i can tell you the story. It may concern Pest or Collision, but i had a problem in the AfterAll() hook. I work in my tests with php resources, so i created a static service to open and get then manually close all the created resources by calling a flush() method inside the afterAll hook. Apparently, some of the resources was already closed when calling fclose() so i got a TypeError without knowing it because all the tests passed. In Pest, this means having an "ErroredEvents", this also blocked my "code coverage", and Pest return in the shell an exit code 2 that is blocking in my CI/CD.
In order to determine the error, I had to go in the vendor / Pest code to dump the error that is called "ErroredEvents" but that is not displayed.
As examples, here is how i dumped the errors :
See vendor/pestphp/pest/src/Kernel.php
// Method handle()// Code begin from line 114$result = Facade::result();
$result->hasTestErroredEvents();
$result->numberOfTestErroredEvents();
$result->testErroredEvents();
The same thing can be find in the vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php file where the writeRecap() method was the perfect place for me to display these errors without denaturing the rest of the code.
How to Reproduce
Inside the AfterAll() hook, open a resource with tmpfile(), then close it two times with fclose() in order to get my php error.
All the tests will pass, but the shell will return an exit code 2.
Sample Repository
No response
Pest Version
3.7.4
PHP Version
8.3.17
Operation System
Linux
Notes
How to solve the problem ?
I need your expertise. I cannot do what is wrote in the CONTRIBUTING.md file because i need to have your expertise. What is the best thing to do about these errors ? How to improve Pest, by displaying or is there another way to catch these errors ?
Here is what i have done, which is rudimentary but it works without denaturing the rest of the code :
See vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php line 246
Good morning,
OS (Docker)
Linux under Docker (base image : ubuntu:22.04)
Xdebug enabled.
Versions
PHP : 8.3.17
Pest : 3.7.4
Collision : 8.6.1
What Happened
Short story
When a TypeError is thrown inside the afterAll hook, nothing is displayed but the process return as well as expected the error code 2. We cannot determine the error caused since no message is displayed.
Long story
My repository is private, but i can tell you the story. It may concern Pest or Collision, but i had a problem in the
AfterAll()
hook. I work in my tests with php resources, so i created a static service to open and get then manually close all the created resources by calling aflush()
method inside theafterAll
hook. Apparently, some of the resources was already closed when callingfclose()
so i got a TypeError without knowing it because all the tests passed. In Pest, this means having an "ErroredEvents", this also blocked my "code coverage", and Pest return in the shell an exit code 2 that is blocking in my CI/CD.In order to determine the error, I had to go in the vendor / Pest code to dump the error that is called "ErroredEvents" but that is not displayed.
As examples, here is how i dumped the errors :
See
vendor/pestphp/pest/src/Kernel.php
The same thing can be find in the
vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php
file where thewriteRecap()
method was the perfect place for me to display these errors without denaturing the rest of the code.How to Reproduce
Inside the
AfterAll()
hook, open a resource withtmpfile()
, then close it two times withfclose()
in order to get my php error.All the tests will pass, but the shell will return an exit code 2.
Sample Repository
No response
Pest Version
3.7.4
PHP Version
8.3.17
Operation System
Linux
Notes
How to solve the problem ?
I need your expertise. I cannot do what is wrote in the
CONTRIBUTING.md
file because i need to have your expertise. What is the best thing to do about these errors ? How to improve Pest, by displaying or is there another way to catch these errors ?Here is what i have done, which is rudimentary but it works without denaturing the rest of the code :
See
vendor/nunomaduro/collision/src/Adapters/Phpunit/Style.php
line246
The text was updated successfully, but these errors were encountered: