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.
  • Loading branch information
Trott committed May 18, 2016
1 parent 0350505 commit 083a23e
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 083a23e

Please sign in to comment.