-
-
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
Improve error message format for Node's assert.fail #9262
Conversation
if (stack.match('.fail')) { | ||
return 'fail'; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stack.match
fallback is only needed for Node versions older than v10.11 because it wan't until v10.11.0 that the AssertionError
of assert.fail
had an operator
value set by default (nodejs/node#22694).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention that in a comment, it's common to grep the codebase for things like node 10
when phasing out support for an EOL version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing changelog entry, but the code looks great. Thanks!
Thank you! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This PR fixes incorrect error message format when using Node's
assert.fail
.Currently when using
assert.fail
in a test, We get a message that includes two parts that should be omitted:undefined
sThis was fixed by updating the node assert message helpers in both of
jest-jasmine2
andjest-circus
to account for thefail
operator.Before
After
Test plan
Added two new tests to make sure the error message printed for
assert.fail
looks as expected.