From 141cd235576f23a88db50e9a1d73a3393ceb7bbe Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 6 Oct 2018 18:27:28 -0700 Subject: [PATCH] test: remove internal errorCache property The internal `assert` modules `errorCache` property is exposed only for testing. The one test that used it is rewritten here to not use it. This has the following advantages: * The test now makes sure that there is an empty cache in a more robust way. Instead of relying on the internal implementation of `errorCache`, it simply spawns a separate process. * One less test using the `--expose-internals` flag. PR-URL: https://github.com/nodejs/node/pull/23304 Reviewed-By: Ruben Bridgewater Reviewed-By: Sakthipriyan Vairamani --- .../parallel/test-assert-builtins-not-read-from-filesystem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7a713a2ea432c1..7855f830add10b 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, line, column] = frames[1].match(/\((.+):(\d+):(\d+)\)/); + const [, filename, , ] = 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, line, column], + [process.argv[1], 'child', filename], { cwd: tmpdir.path, env: process.env }); assert.ifError(error); assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`);