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: #41801
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Mestery <[email protected]>
  • Loading branch information
Trott authored and ruyadorno committed Feb 8, 2022
1 parent 4eb1938 commit 87902a7
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 87902a7

Please sign in to comment.