Skip to content

Commit

Permalink
test: specify global object for globals
Browse files Browse the repository at this point in the history
Be explicit about using `global.externalizeString()` etc. in
test-fs-write instead of disabling the `no-undef` ESLint rule.

PR-URL: #36498
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and targos committed May 1, 2021
1 parent c32c109 commit 5ef609a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/parallel/test-fs-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) => {
Expand Down

0 comments on commit 5ef609a

Please sign in to comment.