diff --git a/lib/assert.js b/lib/assert.js index 69618862f2182c..4dbe3b2eca3d01 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -26,12 +26,14 @@ const { codes: { ERR_INVALID_ARG_TYPE, ERR_INVALID_RETURN_VALUE } } = require('internal/errors'); -const { AssertionError, errorCache } = require('internal/assert'); +const { AssertionError } = require('internal/assert'); const { openSync, closeSync, readSync } = require('fs'); const { inspect, types: { isPromise, isRegExp } } = require('util'); const { EOL } = require('internal/constants'); const { NativeModule } = require('internal/bootstrap/loaders'); +const errorCache = new Map(); + let isDeepEqual; let isDeepStrictEqual; let parseExpressionAt; diff --git a/lib/internal/assert.js b/lib/internal/assert.js index 2e91b08006b242..3b19f2c39d9528 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -271,6 +271,5 @@ class AssertionError extends Error { } module.exports = { - AssertionError, - errorCache: new Map() + AssertionError }; diff --git a/test/parallel/test-assert-builtins-not-read-from-filesystem.js b/test/parallel/test-assert-builtins-not-read-from-filesystem.js index 7855f830add10b..7a713a2ea432c1 100644 --- a/test/parallel/test-assert-builtins-not-read-from-filesystem.js +++ b/test/parallel/test-assert-builtins-not-read-from-filesystem.js @@ -19,13 +19,13 @@ if (process.argv[2] !== 'child') { e.emit('hello', false); } catch (err) { const frames = err.stack.split('\n'); - const [, filename, , ] = frames[1].match(/\((.+):(\d+):(\d+)\)/); + const [, filename, line, column] = frames[1].match(/\((.+):(\d+):(\d+)\)/); // Spawn a child process to avoid the error having been cached in the assert // module's `errorCache` Map. const { output, status, error } = spawnSync(process.execPath, - [process.argv[1], 'child', filename], + [process.argv[1], 'child', filename, line, column], { cwd: tmpdir.path, env: process.env }); assert.ifError(error); assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);