mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 21:58:48 +02:00
assert: add more information to AssertionErrors
This adds information about the actual thrown error to the AssertionError's message property. It also improves the logged error instances error name by using the constructors name, if available. PR-URL: https://github.com/nodejs/node/pull/28263 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
5700cd17dd
commit
97c52ca5dc
3 changed files with 16 additions and 5 deletions
|
@ -73,7 +73,8 @@ const invalidThenableFunc = () => {
|
|||
() => assert.rejects(Promise.reject(err), validate),
|
||||
{
|
||||
message: 'The "validate" validation function is expected to ' +
|
||||
"return \"true\". Received 'baz'",
|
||||
"return \"true\". Received 'baz'\n\nCaught error:\n\n" +
|
||||
'Error: foobar',
|
||||
code: 'ERR_ASSERTION',
|
||||
actual: err,
|
||||
expected: validate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue