summaryrefslogtreecommitdiff
path: root/test/message
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-05-02 16:59:49 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2018-05-10 14:14:23 +0200
commit560925fe22bfc23860b04704ff4cae21e4dd19ff (patch)
tree2e2be1e170fea1f8ae366d6c3b1a29bb0ea32445 /test/message
parent5e6ca894cfc50690366a501be52e7248f3574d06 (diff)
downloadandroid-node-v8-560925fe22bfc23860b04704ff4cae21e4dd19ff.tar.gz
android-node-v8-560925fe22bfc23860b04704ff4cae21e4dd19ff.tar.bz2
android-node-v8-560925fe22bfc23860b04704ff4cae21e4dd19ff.zip
assert: make sure throws is able to handle primitives
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>
Diffstat (limited to 'test/message')
-rw-r--r--test/message/assert_throws_stack.out4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/message/assert_throws_stack.out b/test/message/assert_throws_stack.out
index 62a25a6367..3d5f4de4cf 100644
--- a/test/message/assert_throws_stack.out
+++ b/test/message/assert_throws_stack.out
@@ -1,6 +1,6 @@
assert.js:*
- throw new AssertionError(obj);
- ^
+ throw err;
+ ^
AssertionError [ERR_ASSERTION]: Input A expected to strictly deep-equal input B:
+ expected - actual