Skip to content

Commit 0ac87c2

Browse files
LekoMylesBorins
authored andcommitted
test: replace assert.throws with common.expectsError
PR-URL: #17445 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent cd7cee5 commit 0ac87c2

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

test/addons-napi/test_error/test.js

+9-12
Original file line numberDiff line numberDiff line change
@@ -60,29 +60,26 @@ assert.throws(() => {
6060
test_error.throwTypeError();
6161
}, /^TypeError: type error$/);
6262

63-
assert.throws(
63+
common.expectsError(
6464
() => test_error.throwErrorCode(),
65-
common.expectsError({
65+
{
6666
code: 'ERR_TEST_CODE',
6767
message: 'Error [error]'
68-
})
69-
);
68+
});
7069

71-
assert.throws(
70+
common.expectsError(
7271
() => test_error.throwRangeErrorCode(),
73-
common.expectsError({
72+
{
7473
code: 'ERR_TEST_CODE',
7574
message: 'RangeError [range error]'
76-
})
77-
);
75+
});
7876

79-
assert.throws(
77+
common.expectsError(
8078
() => test_error.throwTypeErrorCode(),
81-
common.expectsError({
79+
{
8280
code: 'ERR_TEST_CODE',
8381
message: 'TypeError [type error]'
84-
})
85-
);
82+
});
8683

8784
let error = test_error.createError();
8885
assert.ok(error instanceof Error, 'expected error to be an instance of Error');

0 commit comments

Comments
 (0)