-
-
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
Tests can pass despite assertion failures #4401
Comments
@rogeliog perhaps you could take a look? Would be nice to know if this is at least confirmed by Jest collaborators. Confirmed on my end. Sorry for the ping but this has gotten no acknowledgement in 2 weeks :) |
This should be handled properly in Jest 21, see: #2059. |
I've upgraded the example repo to Jest 21.1.0 and unfortunately the bug still persists. Kind of inclined to leave this issue closed though, as I sense this is somehow a fundamentally difficult thing about building a JavaScript unit testing framework. Fixing it would probably entail a significant backwards compatibility breakage as well, cos I suspect there are a lot of folks out there with test suites that depend on this bug in order to pass, despite lots of assertion failures they've never noticed. If it's not easily fixable, one thing I think would be a lovely alternative is if Jest could be configured to print some kind of warning when an AssertionError is thrown by a passing test. I'd certainly love to be able to quantify the impact of this behaviour in our codebase and check it's not hiding any actual bugs 😄 |
As far as I understand the thing that could be fixed here is that |
In that example I think the |
right, sorry the first one is the wrong one, I misread interesting this sounds like a bug definitely then |
Since this seems valid can it be reopened? @dignifiedquire |
EDIT: Oh, this might relate to #2059, but not this issue. Sorry about the noise. This fails when using Using
Using
Minimal repro: https://github.com/kjbekkelund/jest-timeout-issue-jsdom |
@kimjoar on Jest 23 it consistently fails on both environments :) |
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. |
Hey there! I suspect there might be a good explanation for this, but it also seems possible for it to be a bug, so here goes! 😄
Current Behaviour
Tests can pass despite the failure of some of the assertions that they execute. As per the instructions in the issue template, I've prepared a minimal repository on GitHub that demonstrates the issue with as little unnecessary extra detail as possible. I'll paste the code here as well since it's small enough to do so.
Expected Behaviour
If any assertion fails, the test should fail. In my example above, the
expect(six).toEqual(6)
assertion fails but the test passes anyway.Misc Runtime Environment Information
The text was updated successfully, but these errors were encountered: