diff options
author | estrada9166 <estrada9166@hotmail.com> | 2019-06-23 22:55:32 -0500 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-07-02 00:40:07 +0200 |
commit | 367ada49f192d9767d80701786d44f648e4b9a9d (patch) | |
tree | 3edde80b19de242656039a2cf6886596f7bd72fe | |
parent | 6e9d79564234919b656a92da3e0ac3bc8a49bc2c (diff) | |
download | android-node-v8-367ada49f192d9767d80701786d44f648e4b9a9d.tar.gz android-node-v8-367ada49f192d9767d80701786d44f648e4b9a9d.tar.bz2 android-node-v8-367ada49f192d9767d80701786d44f648e4b9a9d.zip |
test: add test to doesNotThrow; validate if actual with regex
Refs: https://coverage.nodejs.org/coverage-1a4f27ae21698d0c/lib/assert.js.html#L736
PR-URL: https://github.com/nodejs/node/pull/28355
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
-rw-r--r-- | test/parallel/test-assert.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index 32b2bca641..2959f54c7a 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -178,6 +178,17 @@ assert.throws( } ); +assert.throws( + () => a.doesNotThrow(() => thrower(Error), /\[[a-z]{6}\s[A-z]{6}\]/g, 'user message'), + { + name: 'AssertionError', + code: 'ERR_ASSERTION', + operator: 'doesNotThrow', + message: 'Got unwanted exception: user message\n' + + 'Actual message: "[object Object]"' + } +); + // Make sure that validating using constructor really works. { let threw = false; |