Skip to content

Commit

Permalink
test: refactor to eliminate __defineGetter__
Browse files Browse the repository at this point in the history
In preparation for a lint rule to flag `__defineGetter__`, refactor the
one remaining instance in the code base.

PR-URL: #6774
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and rvagg committed Jun 2, 2016
1 parent 12a3d01 commit c81b6f8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c81b6f8

Please sign in to comment.