-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Failed assert() should show a backtrace #4913
Comments
I have the exact same issue when testing my code. It drives me insane. I have I assume that it has to do with the fact that PHPUnit catches Usually a In the event of having a sanity check buried deep within the code, you get an output like PHPUnit version 9.5.21 Current behavior
How to reproduceAny Expected behavior
|
The fix doesn't seem to be working. I am on PHPUnit 9.5.28, and in the TestResult class I see this which matches the fix:
However, my output for a failed assertion is:
Another simpler example to reproduce:
I get:
|
Please understand that I cannot debug examples that depend on third-party software such as Drupal. I will gladly reopen this issue and investigate further if you can provide a minimal, self-contained, reproducing example. |
Understood - try the code snippet with the testFailAssert() method. |
Scratch that - I get a backtrace on a simpler project with that code:
|
Drupal runs its kernel tests in a separate process - could that be the problem? |
Here's a test case that shows the problem:
|
Summary
If a test fails because an
assert()
fails, the test output only shows the assert message. There is no backtrace, unlike when a test fails because of a thrown exception.Current behavior
How to reproduce
Expected behavior
The text was updated successfully, but these errors were encountered: