From 1d20e30c1876bf939d9b0a19c900783d577ef68b Mon Sep 17 00:00:00 2001 From: Levin Eugene Date: Sun, 26 May 2019 17:24:33 +0300 Subject: [PATCH] test: add test for util.inspect add test case for util.inspect with 'depth' option set to 'null' and with that has a custom inspect function attached --- test/parallel/test-util-inspect.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 16ea2a40e803f4..ac576ec7cbf9d2 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -852,6 +852,13 @@ util.inspect({ hasOwnProperty: null }); util.inspect(subject, { customInspectOptions: true, seen: null }); } +{ + const subject = { [util.inspect.custom]: common.mustCall((depth) => { + assert.strictEqual(depth, null); + }) }; + util.inspect(subject, { depth: null }); +} + { // Returning `this` from a custom inspection function works. const subject = { a: 123, [util.inspect.custom]() { return this; } };