assert: remove internal errorCache property

The internal assert module exposed an errorCache property solely for
testing. It is no longer necessary. Remove it.

PR-URL: https://github.com/nodejs/node/pull/23304
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
Rich Trott 2018-10-06 18:27:54 -07:00
parent 1f94b85069
commit 4d58c08865
3 changed files with 6 additions and 5 deletions

View File

@ -27,12 +27,14 @@ const { codes: {
ERR_INVALID_ARG_VALUE,
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;

View File

@ -396,6 +396,5 @@ class AssertionError extends Error {
}
module.exports = {
AssertionError,
errorCache: new Map()
AssertionError
};

View File

@ -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}`);