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: https://github.com/nodejs/node/pull/27906 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
parent
fc7c5b9795
commit
3b50bded08
@ -852,6 +852,13 @@ util.inspect({ hasOwnProperty: null });
|
|||||||
util.inspect(subject, { customInspectOptions: true, seen: 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.
|
// Returning `this` from a custom inspection function works.
|
||||||
const subject = { a: 123, [util.inspect.custom]() { return this; } };
|
const subject = { a: 123, [util.inspect.custom]() { return this; } };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user