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:
parent
1f94b85069
commit
4d58c08865
@ -27,12 +27,14 @@ const { codes: {
|
|||||||
ERR_INVALID_ARG_VALUE,
|
ERR_INVALID_ARG_VALUE,
|
||||||
ERR_INVALID_RETURN_VALUE
|
ERR_INVALID_RETURN_VALUE
|
||||||
} } = require('internal/errors');
|
} } = require('internal/errors');
|
||||||
const { AssertionError, errorCache } = require('internal/assert');
|
const { AssertionError } = require('internal/assert');
|
||||||
const { openSync, closeSync, readSync } = require('fs');
|
const { openSync, closeSync, readSync } = require('fs');
|
||||||
const { inspect, types: { isPromise, isRegExp } } = require('util');
|
const { inspect, types: { isPromise, isRegExp } } = require('util');
|
||||||
const { EOL } = require('internal/constants');
|
const { EOL } = require('internal/constants');
|
||||||
const { NativeModule } = require('internal/bootstrap/loaders');
|
const { NativeModule } = require('internal/bootstrap/loaders');
|
||||||
|
|
||||||
|
const errorCache = new Map();
|
||||||
|
|
||||||
let isDeepEqual;
|
let isDeepEqual;
|
||||||
let isDeepStrictEqual;
|
let isDeepStrictEqual;
|
||||||
let parseExpressionAt;
|
let parseExpressionAt;
|
||||||
|
@ -396,6 +396,5 @@ class AssertionError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
AssertionError,
|
AssertionError
|
||||||
errorCache: new Map()
|
|
||||||
};
|
};
|
||||||
|
@ -19,13 +19,13 @@ if (process.argv[2] !== 'child') {
|
|||||||
e.emit('hello', false);
|
e.emit('hello', false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const frames = err.stack.split('\n');
|
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
|
// Spawn a child process to avoid the error having been cached in the assert
|
||||||
// module's `errorCache` Map.
|
// module's `errorCache` Map.
|
||||||
|
|
||||||
const { output, status, error } =
|
const { output, status, error } =
|
||||||
spawnSync(process.execPath,
|
spawnSync(process.execPath,
|
||||||
[process.argv[1], 'child', filename],
|
[process.argv[1], 'child', filename, line, column],
|
||||||
{ cwd: tmpdir.path, env: process.env });
|
{ cwd: tmpdir.path, env: process.env });
|
||||||
assert.ifError(error);
|
assert.ifError(error);
|
||||||
assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);
|
assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user