Skip to content

Commit

Permalink
test: avoid using Object.prototype methods directly on objects
Browse files Browse the repository at this point in the history
This prepares us to enable the no-prototype-builtins ESLint rule.

Refs: https://eslint.org/docs/rules/no-prototype-builtins

PR-URL: nodejs#41801
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
Trott authored and VoltrexKeyva committed Feb 3, 2022
1 parent e822e88 commit be84f88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-console-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit be84f88

Please sign in to comment.