-
Notifications
You must be signed in to change notification settings - Fork 134
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
[Request] Hide the JUnit Callstack from the stacktrace #1281
Comments
@leogott Could you give an example of what's the original stack trace looks like? In the example you gave, why we just hide the first part of the stack trace but leave the second one as it is? |
For a small example I wrote (junit5 assert throws expects A but receives B caused by C), I get this unabbreviated result. Every line beginning with I don't care about the callstack of the AssertionFailedError (beyond that it was in line 25 of AppTest.java) , because it was thrown by the assertThrows method. I do however care about the Cause (the exception of wrong type), and where it originated. So in this case I'm getting the following information:
But this is what I care about:
Would it be possible to at least cut the callstack for the AssertionFailed Exception that fails the Test? |
I see, so that is to only reserve the stack trace which belongs to the source? |
Oh you're correct. I didn't look at it that way, but it absolutely is just the parts of the callstack within the source at test. Yes, I'd like to see a filtered view or something that cuts away the callstack that doesn't belong to the source. |
Get a very similar feedback from a customer interview. He hope the stacktrace can be hidden by clicking some buttons like |
Hi @leogott, I pushed a change to filter out those 'internal' traces. Currently we don't have a setting to control it. But we can definitely add a setting for that if users require. You can try the new behavior in the next pre-release of the extension (should be available tomorrow). Let me know if you have any feedback, thanks! |
To verify this issue
// cc @testforstephen |
There are (few, but there are) cases in which I'd like to take a look at the callstack for a failed (as opposed errored) test. Mainly when using assertThrows. However I would like to have it shortened by default so that in the simplest case every line starting with
at org.junit
is replaced with the... X more lines
just like the end is shortened right now.I'd be satisfied with a setting like "shorten lines matching this regex from the stack trace".
For example when assertThrows fails, because instead of ExpectedException I got DifferentException, I'd love the output to look like
The text was updated successfully, but these errors were encountered: