Browse Source

test: refactor to eliminate __defineGetter__

In preparation for a lint rule to flag `__defineGetter__`, refactor the
one remaining instance in the code base.

PR-URL: https://github.com/nodejs/node/pull/6774
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Rich Trott 9 years ago
committed by Rod Vagg
parent
commit
c81b6f8d0d
  1. 11
      test/parallel/test-util-inspect.js

11
test/parallel/test-util-inspect.js

@ -205,9 +205,14 @@ assert.equal(util.inspect(value), '{ a: [Circular] }');
// Array with dynamic properties
value = [1, 2, 3];
value.__defineGetter__('growingLength', function() {
this.push(true); return this.length;
});
Object.defineProperty(
value,
'growingLength',
{
enumerable: true,
get: () => { this.push(true); return this.length; }
}
);
assert.equal(util.inspect(value), '[ 1, 2, 3, growingLength: [Getter] ]');
// Function with properties

Loading…
Cancel
Save