diff --git a/test/addons-napi/test_error/test.js b/test/addons-napi/test_error/test.js index f07326c202a569..d4b1d8a971ee09 100644 --- a/test/addons-napi/test_error/test.js +++ b/test/addons-napi/test_error/test.js @@ -61,9 +61,12 @@ assert.throws(() => { }, /^TypeError: type error$/); function testThrowArbitrary(value) { - assert.throws(() => { - test_error.throwArbitrary(value); - }, value); + assert.throws( + () => test_error.throwArbitrary(value), + (err) => { + assert.strictEqual(err, value); + return true; + }); } testThrowArbitrary(42); @@ -71,6 +74,10 @@ testThrowArbitrary({}); testThrowArbitrary([]); testThrowArbitrary(Symbol('xyzzy')); testThrowArbitrary(true); +testThrowArbitrary('ball'); +testThrowArbitrary(undefined); +testThrowArbitrary(null); +testThrowArbitrary(NaN); common.expectsError( () => test_error.throwErrorCode(),