Skip to content

Commit 89987b3

Browse files
TrottMylesBorins
authored andcommitted
test: remove common.expectsInternalAssertion
Remove convenience function for internal assertions. It is only used once. Signed-off-by: Rich Trott <[email protected]> PR-URL: #32057 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anto Aravinth <[email protected]>
1 parent 31e4a0d commit 89987b3

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

test/common/index.js

-14
Original file line numberDiff line numberDiff line change
@@ -547,19 +547,6 @@ function expectsError(validator, exact) {
547547
}, exact);
548548
}
549549

550-
const suffix = 'This is caused by either a bug in Node.js ' +
551-
'or incorrect usage of Node.js internals.\n' +
552-
'Please open an issue with this stack trace at ' +
553-
'https://github.com/nodejs/node/issues\n';
554-
555-
function expectsInternalAssertion(fn, message) {
556-
assert.throws(fn, {
557-
message: `${message}\n${suffix}`,
558-
name: 'Error',
559-
code: 'ERR_INTERNAL_ASSERTION'
560-
});
561-
}
562-
563550
function skipIfInspectorDisabled() {
564551
if (!process.features.inspector) {
565552
skip('V8 inspector is disabled');
@@ -680,7 +667,6 @@ const common = {
680667
createZeroFilledFile,
681668
disableCrashOnUnhandledRejection,
682669
expectsError,
683-
expectsInternalAssertion,
684670
expectWarning,
685671
getArrayBufferViews,
686672
getBufferSources,

test/parallel/test-internal-errors.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Flags: --expose-internals
22
'use strict';
3-
const common = require('../common');
3+
require('../common');
44
const {
55
hijackStdout,
66
restoreStdout,
@@ -50,10 +50,13 @@ errors.E('TEST_ERROR_2', (a, b) => `${a} ${b}`, Error);
5050
}
5151

5252
{
53-
common.expectsInternalAssertion(
53+
assert.throws(
5454
() => new errors.codes.TEST_ERROR_1(),
55-
'Code: TEST_ERROR_1; The provided arguments ' +
56-
'length (0) does not match the required ones (1).'
55+
{
56+
message: /^Code: TEST_ERROR_1; The provided arguments length \(0\) does not match the required ones \(1\)\./,
57+
name: 'Error',
58+
code: 'ERR_INTERNAL_ASSERTION'
59+
}
5760
);
5861
}
5962

test/sequential/test-fs-watch.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,18 @@ tmpdir.refresh();
117117
// https://github.com/joyent/node/issues/6690
118118
{
119119
let oldhandle;
120-
common.expectsInternalAssertion(
120+
assert.throws(
121121
() => {
122122
const w = fs.watch(__filename, common.mustNotCall());
123123
oldhandle = w._handle;
124124
w._handle = { close: w._handle.close };
125125
w.close();
126126
},
127-
'handle must be a FSEvent'
127+
{
128+
message: /^handle must be a FSEvent/,
129+
name: 'Error',
130+
code: 'ERR_INTERNAL_ASSERTION',
131+
}
128132
);
129133
oldhandle.close(); // clean up
130134
}

0 commit comments

Comments
 (0)