lib: replace 'assert' with 'internal/assert' for many built-ins

Replace large 'assert' module with tiny 'internal/assert' module for
many built-in uses.

PR-URL: https://github.com/nodejs/node/pull/25956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
This commit is contained in:
Rich Trott
2019-02-05 21:45:46 -08:00
parent 5d609bb11c
commit 62942e9ad7
18 changed files with 22 additions and 21 deletions

View File

@@ -5,7 +5,7 @@ process.emitWarning(
'internal/test/heap');
const { createHeapDump, buildEmbedderGraph } = internalBinding('heap_utils');
const assert = require('assert');
const assert = require('internal/assert');
// This is not suitable for production code. It creates a full V8 heap dump,
// parses it as JSON, and then creates complex objects from it, leading
@@ -44,9 +44,10 @@ function createJSHeapDump() {
edgeIndex++;
}
for (const node of nodes)
assert.strictEqual(node.edge_count, node.outgoingEdges.length);
for (const node of nodes) {
assert(node.edge_count === node.outgoingEdges.length,
`${node.edge_count} !== ${node.outgoingEdges.length}`);
}
return nodes;
}