diff --git a/lib/internal/assert.js b/lib/internal/assert.js index b5eb88c93b61db..e403fd4b60e06a 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -6,4 +6,10 @@ function assert(value, message) { } } +function fail(message) { + require('assert').fail(message); +} + +assert.fail = fail; + module.exports = assert; diff --git a/lib/internal/cluster/round_robin_handle.js b/lib/internal/cluster/round_robin_handle.js index 95f33ad1d09907..86c7bec7386ed7 100644 --- a/lib/internal/cluster/round_robin_handle.js +++ b/lib/internal/cluster/round_robin_handle.js @@ -1,5 +1,5 @@ 'use strict'; -const assert = require('assert'); +const assert = require('internal/assert'); const net = require('net'); const { sendHelper } = require('internal/cluster/utils'); const uv = internalBinding('uv'); diff --git a/test/parallel/test-internal-assert.js b/test/parallel/test-internal-assert.js index b34657d3a67f84..4fd443864bdac7 100644 --- a/test/parallel/test-internal-assert.js +++ b/test/parallel/test-internal-assert.js @@ -13,3 +13,5 @@ internalAssert(true, 'fhqwhgads'); assert.throws(() => { internalAssert(false); }, assert.AssertionError); assert.throws(() => { internalAssert(false, 'fhqwhgads'); }, { code: 'ERR_ASSERTION', message: 'fhqwhgads' }); +assert.throws(() => { internalAssert.fail('fhqwhgads'); }, + { code: 'ERR_ASSERTION', message: 'fhqwhgads' });