summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIlya Shaisultanov <ishaisultanov@shutterstock.com>2015-08-16 20:35:38 -0700
committerJames M Snell <jasnell@gmail.com>2016-04-18 16:49:26 -0700
commitc1d82ac2ff15594840e2a1b9531b506ae067ed27 (patch)
treeeec676ab5fa1d8c5cae829cb4348c1fdf9e9fc5f /test
parent9a9beefe23ddd9550f04aa4f15c50bd3fdb146dd (diff)
downloadandroid-node-v8-c1d82ac2ff15594840e2a1b9531b506ae067ed27.tar.gz
android-node-v8-c1d82ac2ff15594840e2a1b9531b506ae067ed27.tar.bz2
android-node-v8-c1d82ac2ff15594840e2a1b9531b506ae067ed27.zip
assert: respect assert.doesNotThrow message.
Special handling to detect when user has supplied a custom message. Added a test for user message. When testing if `actual` value is an error use `util.isError` instead of `instanceof`. Fixes: https://github.com/nodejs/node/issues/2385 PR-URL: https://github.com/nodejs/node/pull/2407 Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-assert.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index 2f4b757f4e..e537bc3c1d 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -321,6 +321,11 @@ assert.throws(function() {assert.ifError(new Error('test error'));});
assert.doesNotThrow(function() {assert.ifError(null);});
assert.doesNotThrow(function() {assert.ifError();});
+assert.throws(() => {
+ assert.doesNotThrow(makeBlock(thrower, Error), 'user message');
+}, /Got unwanted exception. user message/,
+ 'a.doesNotThrow ignores user message');
+
// make sure that validating using constructor really works
threw = false;
try {