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
feat: make detailed errors opt-in #15016
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@SimenB could you let me know if this is something you'd be ok to land in any form? and if so let me know how far you'd like to go i.e. do we still care about Jasmine, and do we need to have an extensive set of tests that tries to cover behaviour both with and without the flag and with and without circular references, etc? |
oh and I tested this worked with |
The "error with cause" snapshot change looks odd to me - not sure why this change would mean it no longer includes an entire error...? |
3c6e307
to
01c50ef
Compare
Ok so it looks like in #13966 Jest might have started using What's interesting though is that PR is titled as adding support for Either way it's an extra bit of annoyance but I still think having this flag is worth it Ok I think what this is is that #13965 landed support for |
cd09737
to
d7ab1b1
Compare
This comment was marked as resolved.
This comment was marked as resolved.
d7ab1b1
to
d7c0f27
Compare
35807d6
to
08550d7
Compare
08550d7
to
45ad8c0
Compare
Summary
This aims to reduce the occurence of #10577 without solving it entirely by making what I believe to be the main source (#9496) opt-in (which we can do because this is being landed in a new major).
More specifically, it changes
jest-circus
to not include "detailed" errors by default unless the--detailed-errors-in-results
flag is passed; including these causes circular reference errors because they're actually a JavaScript reference to whatever error that got thrown in a test - on a good day, that'll be a Jest assertion error as a result of anexpect
failure (which don't have any circular references), but the error can be literally anything including those thrown by ESLint in itsRuleTester
(which includes the AST tree which has circular references) and arbitrary objects that can include functions (which cannot be serialized).As far as I know these detailed errors are actually only being used by JetBrains IDEs and it should be trivial for those that want to actually use them to provide the new flag to have their details included, and being able to account for the tradeoffs (namely "you might get circular reference errors").
Alternatively this could be landed with the inverse default, which'd still be useful by allowing users to explicitly have those details left out so they can see what the actual error they're getting is with the understanding that their tooling might not be as effective due to the detailed errors being missing.
Test plan
umm write some tests, probably