diff --git a/test/common/index.js b/test/common/index.js index 653de4685ca7a0..28ce841c48cc3f 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -547,19 +547,6 @@ function expectsError(validator, exact) { }, exact); } -const suffix = 'This is caused by either a bug in Node.js ' + - 'or incorrect usage of Node.js internals.\n' + - 'Please open an issue with this stack trace at ' + - 'https://github.com/nodejs/node/issues\n'; - -function expectsInternalAssertion(fn, message) { - assert.throws(fn, { - message: `${message}\n${suffix}`, - name: 'Error', - code: 'ERR_INTERNAL_ASSERTION' - }); -} - function skipIfInspectorDisabled() { if (!process.features.inspector) { skip('V8 inspector is disabled'); @@ -680,7 +667,6 @@ const common = { createZeroFilledFile, disableCrashOnUnhandledRejection, expectsError, - expectsInternalAssertion, expectWarning, getArrayBufferViews, getBufferSources, diff --git a/test/parallel/test-internal-errors.js b/test/parallel/test-internal-errors.js index fbb8a0a86a3852..7bcc7dcc330c2c 100644 --- a/test/parallel/test-internal-errors.js +++ b/test/parallel/test-internal-errors.js @@ -1,6 +1,6 @@ // Flags: --expose-internals 'use strict'; -const common = require('../common'); +require('../common'); const { hijackStdout, restoreStdout, @@ -50,10 +50,13 @@ errors.E('TEST_ERROR_2', (a, b) => `${a} ${b}`, Error); } { - common.expectsInternalAssertion( + assert.throws( () => new errors.codes.TEST_ERROR_1(), - 'Code: TEST_ERROR_1; The provided arguments ' + - 'length (0) does not match the required ones (1).' + { + message: /^Code: TEST_ERROR_1; The provided arguments length \(0\) does not match the required ones \(1\)\./, + name: 'Error', + code: 'ERR_INTERNAL_ASSERTION' + } ); } diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index 031e92c61c0b3c..ff0a52c89c6790 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -117,14 +117,18 @@ tmpdir.refresh(); // https://github.com/joyent/node/issues/6690 { let oldhandle; - common.expectsInternalAssertion( + assert.throws( () => { const w = fs.watch(__filename, common.mustNotCall()); oldhandle = w._handle; w._handle = { close: w._handle.close }; w.close(); }, - 'handle must be a FSEvent' + { + message: /^handle must be a FSEvent/, + name: 'Error', + code: 'ERR_INTERNAL_ASSERTION', + } ); oldhandle.close(); // clean up }