Skip to content

Commit

Permalink
test: replace assert.throws with common.expectsError
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Leko authored and MylesBorins committed Dec 12, 2017
1 parent cd7cee5 commit 0ac87c2
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions test/addons-napi/test_error/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,26 @@ assert.throws(() => {
test_error.throwTypeError();
}, /^TypeError: type error$/);

assert.throws(
common.expectsError(
() => test_error.throwErrorCode(),
common.expectsError({
{
code: 'ERR_TEST_CODE',
message: 'Error [error]'
})
);
});

assert.throws(
common.expectsError(
() => test_error.throwRangeErrorCode(),
common.expectsError({
{
code: 'ERR_TEST_CODE',
message: 'RangeError [range error]'
})
);
});

assert.throws(
common.expectsError(
() => test_error.throwTypeErrorCode(),
common.expectsError({
{
code: 'ERR_TEST_CODE',
message: 'TypeError [type error]'
})
);
});

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

0 comments on commit 0ac87c2

Please sign in to comment.