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
Default reporter shouldn't print expected vs actual values when assert.fail called #9137
Comments
Agreed, do you wanna send a PR fixing it? The logic lives in https://github.com/facebook/jest/blob/master/packages/jest-circus/src/formatNodeAssertErrors.ts & https://github.com/facebook/jest/blob/master/packages/jest-jasmine2/src/assertionErrorMessage.ts |
Can i take this issue? |
Already resolved this problem by PR: #9262. This issue can be closed. |
Thanks! |
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. |
🐛 Bug Report
When using the builtin
assert
library, a call toassert.fail
causes Jest to render the test failure as ifstrictEqual
were called, showing an expected value ofundefined
and an actual value ofundefined
.This is confusing because it seems like a
strictEqual
check is failing when it shouldn't be, as the expected and actual values are the same. In reality no equality check is being performed. Further, the method signature that the test reporter defaults to (assert.fail(received, expected)
) has been deprecated.I ran into this issue on jest@24.9.0.
To Reproduce
Steps to reproduce the behavior:
The following test reproduces the behavior. I've also created a repl.it demo illustrating the issue.
This produces the following output:
Expected behavior
I'd expect output something like the following:
envinfo
The text was updated successfully, but these errors were encountered: