diff options
author | Ilya Shaisultanov <ishaisultanov@shutterstock.com> | 2015-08-16 20:35:38 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2016-04-18 16:49:26 -0700 |
commit | c1d82ac2ff15594840e2a1b9531b506ae067ed27 (patch) | |
tree | eec676ab5fa1d8c5cae829cb4348c1fdf9e9fc5f /test | |
parent | 9a9beefe23ddd9550f04aa4f15c50bd3fdb146dd (diff) | |
download | android-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.js | 5 |
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 { |