-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[Feature]: Display Error's cause when test has failed #12999
Comments
Agreed. We should also try to print all of an Do you wanna send a PR for this? Our error formatting mostly lives in https://github.com/facebook/jest/blob/fd4bfbdb1f8f7620c9da543bd68c2251bd347cdb/packages/jest-message-util/src/index.ts |
I have tried looking at the code in that file but am having trouble understanding how it fits into error causes stuff it seems to be just trying to parse already formatted stack traces. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This is still relevant |
Wanna send a PR? 🙂 |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
JS's
Error
class has recently been enhanced with native support for chaining instances together during construction using a second parameter and the{ cause: parentErrorInstance }
option.It would be great if when a test fails because of a throw error the cause of the error would also be displayed.
Motivation
When wrapping errors the cause can give a lot of necessary information to help figure out why a test is failing
Example
N/A, this would just change the default formatter on test failure
Pitch
The changes to
Error
are part of the ECMAScript standard and are available in Node 16 so more people will start using them.The text was updated successfully, but these errors were encountered: