-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
Proposal: include snapshot name in error message #6003
Comments
I think that's a great idea. It's a breaking change, but we're gearing up for version 23 anyways, so that's OK. Wanna send a PR for it? |
I just added a PR #6015 for it. |
* #6003: include snapshot name in error message * #6003: added changelog message * #6003: wrapped snapshot name and count in double quotes * #6003: wrapped snapshot name and count in double quotes -> updated snap * #6003: fixed lint issues in changelog * #6003: writing complete snapshot key to output
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. |
Current behavior
with a jest configuration like this:
Named snapshot test
Consider a snapshot based test including snapshot names for differentiation, e.g.:
It will produce a snapshot file including the snapshot names (
name
,another
) as well:If in a subsequent run the test fails due to a failed expectation it will render this:
The failing snapshot line number is marked accordingly.
Wrapped expect hides origin
If the snapshot expect code is wrapped in some library function:
and the test fails due to a failed expectation it will render this:
Based on the originating line it is now hard to figure out which "sub" snapshot actually failed.
Proposal
Could you please add the snapshot name to the first error message? I.e. like this:
The text was updated successfully, but these errors were encountered: