mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
560925fe22
This fixes some possible issues with `assert.throws` and `assert.rejects` in combination with an validation object. It will now properly handle primitive values being thrown as error. It also makes sure the `generatedMessage` property is properly set if `assert.throws` or `assert.rejects` is used in combination with an validation object and improves the error performance in such cases by only creating the error once. In addition it will fix detecting regular expressions from a different context such as n-api that are passed through as validator for `assert.throws` or `assert.rejects`. Until now those were not tested. PR-URL: https://github.com/nodejs/node/pull/20482 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
21 lines
317 B
Plaintext
21 lines
317 B
Plaintext
assert.js:*
|
|
throw err;
|
|
^
|
|
|
|
AssertionError [ERR_ASSERTION]: Input A expected to strictly deep-equal input B:
|
|
+ expected - actual
|
|
|
|
- Comparison {}
|
|
+ Comparison {
|
|
+ bar: true
|
|
+ }
|
|
at Object.<anonymous> (*assert_throws_stack.js:*:*)
|
|
at *
|
|
at *
|
|
at *
|
|
at *
|
|
at *
|
|
at *
|
|
at *
|
|
at *
|