-
Notifications
You must be signed in to change notification settings - Fork 28.8k
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
assert: provide info about actual error #19884
Conversation
In case a error is caught in `assert.doesNotThrow` or `assert.doesNotReject` it will now also indicate what the real error message was.
} | ||
); | ||
|
||
common.expectsError( |
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.
Duplicated test case.
test/parallel/test-assert.js
Outdated
@@ -839,7 +832,7 @@ common.expectsError( | |||
{ | |||
type: assert.AssertionError, | |||
code: 'ERR_ASSERTION', | |||
message: 'Got unwanted exception.\nundefined' | |||
message: 'Got unwanted exception.\nActual message: undefined' |
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 still uses common.expectsError()
, is this wanted?
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.
Exactly. This call seems similar to https://github.com/nodejs/node/pull/19884/files#diff-81c8c31c5728ec9ed47700e55d9ceebfL127.
Can't this be changed to assert.throws(...)
as well?
Fixed failing test and I added quotes around the actual message to highlight what is part of it. New CI https://ci.nodejs.org/job/node-test-pull-request/14164/ |
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.
LGTM
Landed in 2bee799 |
In case a error is caught in `assert.doesNotThrow` or `assert.doesNotReject` it will now also indicate what the real error message was. PR-URL: nodejs#19884 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
In case a error is caught in `assert.doesNotThrow` or `assert.doesNotReject` it will now also indicate what the real error message was. PR-URL: #19884 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
In case a error is caught in
assert.doesNotThrow
orassert.doesNotReject
it will now also indicate what the realerror message was.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes