From 85d98a9a05e4c7d78f45cb46e62cf6df7a426b75 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 12 Feb 2019 16:44:42 -0800 Subject: [PATCH 1/2] assert: add internal assert.fail() --- lib/internal/assert.js | 6 ++++++ test/parallel/test-internal-assert.js | 2 ++ 2 files changed, 8 insertions(+) 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/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' }); From 8491298d901c066a5292a0c947e2254b4f9b35de Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 11 Feb 2019 07:46:53 -0800 Subject: [PATCH 2/2] cluster: migrate round_robin_handle to internal assert Use smaller internal assert module for round_robin_handle.js. --- lib/internal/cluster/round_robin_handle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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');