diff options
Diffstat (limited to 'lib/internal/util/inspect.js')
-rw-r--r-- | lib/internal/util/inspect.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 52924a4f70..f25c2eaca7 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -1446,7 +1446,20 @@ function formatWithOptions(inspectOptions, ...args) { if (a + 1 !== args.length) { switch (nextChar) { case 115: // 's' - tempStr = String(args[++a]); + const tempArg = args[++a]; + if (typeof tempArg === 'object' && tempArg !== null) { + tempStr = inspect(tempArg, { + ...inspectOptions, + compact: 3, + colors: false, + depth: 0 + }); + // eslint-disable-next-line valid-typeof + } else if (typeof tempArg === 'bigint') { + tempStr = `${tempArg}n`; + } else { + tempStr = String(tempArg); + } break; case 106: // 'j' tempStr = tryStringify(args[++a]); |