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 <targos@protonmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Mestery <mestery@protonmail.com>
  • Loading branch information
Trott authored and danielleadams committed Mar 2, 2022
1 parent ede0d69 commit 58d642a
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 58d642a

Please sign in to comment.