summaryrefslogtreecommitdiff
path: root/test/parallel/test-assert.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-assert.js')
-rw-r--r--test/parallel/test-assert.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index 4115167d4b..c061551604 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -836,3 +836,32 @@ common.expectsError(
}
);
}
+
+assert.throws(
+ () => a.throws(
+ // eslint-disable-next-line no-throw-literal
+ () => { throw 'foo'; },
+ 'foo'
+ ),
+ {
+ code: 'ERR_AMBIGUOUS_ARGUMENT',
+ message: 'The "error/message" argument is ambiguous. ' +
+ 'The error "foo" is identical to the message.'
+ }
+);
+
+assert.throws(
+ () => a.throws(
+ () => { throw new TypeError('foo'); },
+ 'foo'
+ ),
+ {
+ code: 'ERR_AMBIGUOUS_ARGUMENT',
+ message: 'The "error/message" argument is ambiguous. ' +
+ 'The error message "foo" is identical to the message.'
+ }
+);
+
+// Should not throw.
+// eslint-disable-next-line no-restricted-syntax, no-throw-literal
+assert.throws(() => { throw null; }, 'foo');