-
-
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
[Bug]: test.failing()
does not work with failing snapshot
#12825
Comments
related, what should happen in a |
welp... This might be harder than I anticipated :D. After some initial research I think I found that snapshot matchers behave differently to other matchers. Tests that From what I found the failure logic is checked after the To fix this we would probably need to add the Though I might be completely wrong here! |
😅 We should start by adding a caveat to the docs at least |
Just to add, I bump it this while trying to use |
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. |
Bump. Has to be fixed. |
If the snapshot is updated, then the statement would pass inside of
cc: @SimenB I interest in working on this issue |
+1 |
Should snapshots in |
I think all snapshots inside
Are there any more scenarios? |
Agreed. Don't think there are more scenarios. Also, the reason the snapshots fail is because their errors are suppressed when the test's running, then they're processed after the test, in one of the test.failing('Assertions', () => {
expect.assertions(0);
expect(1).toBe(1);
}); I plan to fix both cases. |
Hm.. Not sure about this case. For me it looks like someone made a mistake using |
It's not an intuitive usage, but it does technically affect if a test passes or fails. So if someone expects a failing test to pass because of If you want, I can just focus on the snapshot bug, the two cases need different types of solutions either way. |
Yes, it would be great to make snapshots work with |
Should failed snapshots stop evaluation? Docs also say:
But disclaimers could always be added. In terms of preserving unchecked tests, which is one of the potential issues, I've already handled that regardless of the decision. |
Hm.. I think execution of |
I agree. Snapshots right now get their errors suppressed in |
Also coming to report here that |
@millsp could you open up a separate issue with that (including a minimal reproduction)? 🙂 |
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. |
Version
28.1.0
Steps to reproduce
Seems like
jest.failing()
does not work with failing snapshots. Here is a reproduction: https://github.com/mrazauskas/x-jest-failingSnapshot is failing inside
test.failing()
, but the output is: "Failing test passed even though it was supposed to fail." And later: "1 snapshot failed".@michalwarda Would you like to take a look? (;
Expected behavior
Might be I misunderstood something, but it felt like we should see pass instead of fail.
Actual behavior
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: