From be84f88c0590ce0e1021501d239e9b32dbb41cf4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 31 Jan 2022 14:28:49 -0800 Subject: [PATCH] test: avoid using Object.prototype methods directly on objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This prepares us to enable the no-prototype-builtins ESLint rule. Refs: https://eslint.org/docs/rules/no-prototype-builtins PR-URL: https://github.com/nodejs/node/pull/41801 Reviewed-By: Michaƫl Zasso Reviewed-By: Benjamin Gruenbaum Reviewed-By: Mestery --- test/parallel/test-console-group.js | 2 +- .../test-stream-base-prototype-accessors-enumerability.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-console-group.js b/test/parallel/test-console-group.js index 9b7e836a436add..f1274a9bce6637 100644 --- a/test/parallel/test-console-group.js +++ b/test/parallel/test-console-group.js @@ -151,7 +151,7 @@ function teardown() { // Check that the kGroupIndent symbol property is not enumerable { const keys = Reflect.ownKeys(console) - .filter((val) => console.propertyIsEnumerable(val)) + .filter((val) => Object.prototype.propertyIsEnumerable.call(console, val)) .map((val) => val.toString()); assert(!keys.includes('Symbol(groupIndent)'), 'groupIndent should not be enumerable'); diff --git a/test/parallel/test-stream-base-prototype-accessors-enumerability.js b/test/parallel/test-stream-base-prototype-accessors-enumerability.js index d060a0cb84ce50..1a7f6808fe1780 100644 --- a/test/parallel/test-stream-base-prototype-accessors-enumerability.js +++ b/test/parallel/test-stream-base-prototype-accessors-enumerability.js @@ -14,8 +14,8 @@ const { internalBinding } = require('internal/test/binding'); const TTY = internalBinding('tty_wrap').TTY; { - assert.strictEqual(TTY.prototype.propertyIsEnumerable('bytesRead'), false); - assert.strictEqual(TTY.prototype.propertyIsEnumerable('fd'), false); - assert.strictEqual( - TTY.prototype.propertyIsEnumerable('_externalStream'), false); + const ttyIsEnumerable = Object.prototype.propertyIsEnumerable.bind(TTY); + assert.strictEqual(ttyIsEnumerable('bytesRead'), false); + assert.strictEqual(ttyIsEnumerable('fd'), false); + assert.strictEqual(ttyIsEnumerable('_externalStream'), false); }