From 5ef609af3ed9f173608b2e4bb312e6872b2caba8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 13 Dec 2020 05:16:23 -0800 Subject: [PATCH] test: specify global object for globals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be explicit about using `global.externalizeString()` etc. in test-fs-write instead of disabling the `no-undef` ESLint rule. PR-URL: https://github.com/nodejs/node/pull/36498 Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- test/parallel/test-fs-write.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index c52c958a1fd1a5..63f0245663c435 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -36,8 +36,10 @@ const fn4 = path.join(tmpdir.path, 'write4.txt'); const expected = 'ümlaut.'; const constants = fs.constants; -/* eslint-disable no-undef */ -common.allowGlobals(externalizeString, isOneByteString, x); +const { externalizeString, isOneByteString } = global; + +// Account for extra globals exposed by --expose_externalize_string. +common.allowGlobals(externalizeString, isOneByteString, global.x); { const expected = 'ümlaut sechzig'; // Must be a unique string. @@ -78,7 +80,6 @@ common.allowGlobals(externalizeString, isOneByteString, x); fs.closeSync(fd); assert.strictEqual(fs.readFileSync(fn, 'utf8'), expected); } -/* eslint-enable no-undef */ fs.open(fn, 'w', 0o644, common.mustSucceed((fd) => { const done = common.mustSucceed((written) => {