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.js27
1 files changed, 23 insertions, 4 deletions
diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js
index dba40c0a0e..d3e37afa51 100644
--- a/test/parallel/test-assert.js
+++ b/test/parallel/test-assert.js
@@ -772,6 +772,21 @@ common.expectsError(
}
);
+[
+ 1,
+ false,
+ Symbol()
+].forEach((input) => {
+ assert.throws(
+ () => assert.throws(() => {}, input),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ message: 'The "error" argument must be one of type Object, Error, ' +
+ `Function, or RegExp. Received type ${typeof input}`
+ }
+ );
+});
+
{
const errFn = () => {
const err = new TypeError('Wrong value');
@@ -872,6 +887,14 @@ common.expectsError(
}
assert.throws(
+ () => assert.throws(() => { throw new Error(); }, {}),
+ {
+ message: "The argument 'error' may not be an empty object. Received {}",
+ code: 'ERR_INVALID_ARG_VALUE'
+ }
+);
+
+assert.throws(
() => a.throws(
// eslint-disable-next-line no-throw-literal
() => { throw 'foo'; },
@@ -981,7 +1004,3 @@ assert.throws(
}
);
}
-
-// TODO: This case is only there to make sure there is no breaking change.
-// eslint-disable-next-line no-restricted-syntax, no-throw-literal
-assert.throws(() => { throw 4; }, 4);