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

php artisan test returns exit code 1 if phpunit has warnings, doesn't display them #51272

Closed
imaginedbyme opened this issue May 2, 2024 · 8 comments

Comments

@imaginedbyme
Copy link

Laravel Version

10.31.0

PHP Version

8.2

Database Driver & Version

No response

Description

If you use phpunit tests with Laravel, and run them using php artisan test, the tests can all pass and still return an exit code of 1 if phpunit has warnings artisan doesn't display. This makes GitHub actions testing Laravel projects fail with no warnings/errors if the run command is php artisan test and the current documentation doesn't say anything about it suppressing phpunit warnings.

Steps To Reproduce

If you create a test file but comment any tests out, phpunit returns it as a warning but artisan doesn't, leading to an exit code of 1 with no visible reason why, only by running ./vendor/bin/phpunit can you see the warnings.

@staudenmeir
Copy link
Contributor

Hi @imaginedbyme,
The test command is provided by the nunomaduro/collision package which already has a ticket and a PR for this issue:
nunomaduro/collision#293
nunomaduro/collision#294

@imaginedbyme
Copy link
Author

Ah I didn't see this was from a different package, my apologies I'll close this, thanks for the feedback @staudenmeir !

@khalidmaquilang
Copy link

Screenshot 2024-11-27 at 9 26 58 PM

currently encountering this issue

@AmrSamra
Copy link

AmrSamra commented Dec 5, 2024

Screenshot 2024-12-05 at 6 29 22 PM
same issue

@AVegMor
Copy link

AVegMor commented Dec 19, 2024

Same here

image

@fazio91
Copy link

fazio91 commented Dec 20, 2024

Same here

Screenshot 2024-12-20 alle 14 54 08

@khalidmaquilang
Copy link

I managed to fix this.. there was a class that doesn't have any test case.. i deleted it and it worked so double check your test files

@fazio91
Copy link

fazio91 commented Dec 20, 2024

I managed to fix this.. there was a class that doesn't have any test case.. i deleted it and it worked so double check your test files

Thank you @khalidmaquilang I also had a class without a test inside; I removed it, and everything worked! Thanks!

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

No branches or pull requests

6 participants