diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-09-26 23:17:26 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-10-01 12:38:37 +0200 |
commit | 5e6940d4f6e59433976dc09979f3c8fb116b4230 (patch) | |
tree | 65597c2babccd7f9e829a15fa08228c668ea74a3 /test/parallel/test-util-inherits.js | |
parent | 6df2c556bda34bd685f4086907ca00cdd7b2ea77 (diff) | |
download | android-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.tar.gz android-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.tar.bz2 android-node-v8-5e6940d4f6e59433976dc09979f3c8fb116b4230.zip |
util: set `super_` property to non-enumerable
Using `util.inherits()` adds a `super_` property to the constructor
and inspecting that constructor is going to show that property even
though it's not useful for the user.
Therefore the property is now set as non-enumerable and such entries
are not visible by default when using `console.log()` or
`util.inspect()`.
PR-URL: https://github.com/nodejs/node/pull/23107
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-util-inherits.js')
-rw-r--r-- | test/parallel/test-util-inherits.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/parallel/test-util-inherits.js b/test/parallel/test-util-inherits.js index d37cb6bf8b..9bbb4352dc 100644 --- a/test/parallel/test-util-inherits.js +++ b/test/parallel/test-util-inherits.js @@ -18,7 +18,15 @@ function B(value) { inherits(B, A); B.prototype.b = function() { return this._b; }; -assert.strictEqual(B.super_, A); +assert.deepStrictEqual( + Object.getOwnPropertyDescriptor(B, 'super_'), + { + value: A, + enumerable: false, + configurable: true, + writable: true + } +); const b = new B('b'); assert.strictEqual(b.a(), 'a'); |