diff options
author | Rich Trott <rtrott@gmail.com> | 2018-10-06 18:27:54 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2018-10-09 06:39:46 -0700 |
commit | 4d58c08865d7c996bb8cfbe15793443fd425410f (patch) | |
tree | ca9d10946025ba731f561efacd26ca2cafa406d6 | |
parent | 1f94b850690c2d43d9e29529409d80b372b54484 (diff) | |
download | android-node-v8-4d58c08865d7c996bb8cfbe15793443fd425410f.tar.gz android-node-v8-4d58c08865d7c996bb8cfbe15793443fd425410f.tar.bz2 android-node-v8-4d58c08865d7c996bb8cfbe15793443fd425410f.zip |
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>
-rw-r--r-- | lib/assert.js | 4 | ||||
-rw-r--r-- | lib/internal/assert.js | 3 | ||||
-rw-r--r-- | test/parallel/test-assert-builtins-not-read-from-filesystem.js | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lib/assert.js b/lib/assert.js index 0f3d770358..9990d0e888 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -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; diff --git a/lib/internal/assert.js b/lib/internal/assert.js index e174cddb60..829f666319 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -396,6 +396,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 7855f830ad..7a713a2ea4 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}`); |