Skip to content

Commit 3ba354a

Browse files
Nievltargos
authored andcommitted
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 PR-URL: #27906 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Сковорода Никита Андреевич <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]>
1 parent f621b8f commit 3ba354a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/parallel/test-util-inspect.js

+7
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,13 @@ util.inspect({ hasOwnProperty: null });
852852
util.inspect(subject, { customInspectOptions: true, seen: null });
853853
}
854854

855+
{
856+
const subject = { [util.inspect.custom]: common.mustCall((depth) => {
857+
assert.strictEqual(depth, null);
858+
}) };
859+
util.inspect(subject, { depth: null });
860+
}
861+
855862
{
856863
// Returning `this` from a custom inspection function works.
857864
const subject = { a: 123, [util.inspect.custom]() { return this; } };

0 commit comments

Comments
 (0)