-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix traces in .throws assertions #2021
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code's great!
The code snippet is no longer showing the assertion though. It shows the error being constructed. I think we might have to track both the assertion and the error stack and use them appropriately.
It's getting late here so let me know if you want some pointers. You seem to be pretty good at finding your way around the codebase though!
My thought process was along the lines of: whenever an error is thrown during an ava test, the stack trace always shows where the error was constructed, with the assertion being at the bottom of the trace. If an error is thrown inside a Do you disagree? Is there any situation in which both traces would be required? |
I've updated the PR. The output should be closer to what you had in mind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was we'd store two different "stack" properties. One to determine the source location, the other belonging to thrown errors / rejection reasons. The stack
extracted in trySerializeError
would first use the latter, and if missing fall back to the former. I think that'll work out better than setting a boolean flag.
Thanks @dflupu! |
@dflupu Thank you! You need to submit the PR URL to IssueHunt to claim the bounty ;) |
@sindresorhus No worries, I'll be sure to submit it. I prefer to wait until the PR is accepted/merged because it feels like bad manners to submit before. Might be mostly because of the useless bot post when you do submit. |
Fixes #1372