console: fix table() output

Fixes: https://github.com/nodejs/node/issues/27915

PR-URL: https://github.com/nodejs/node/pull/27917
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Brian White authored and Michaël Zasso committed 2019-05-31 08:46:55 +02:00
1 parent d982f0b7e2
commit 449ee8dd42
2 files changed
+15

No files matched your search

+1
View File
@@ -412,6 +412,7 @@ const consoleMethods = {
const opt = {
depth,
maxArrayLength: 3,
breakLength: Infinity,
...this[kGetInspectOptions](this._stdout)
};
return inspect(v, opt);
+14
View File
@@ -244,3 +244,17 @@ test([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], `
│ 1 │ 'Z' │ 2 │
└─────────┴─────┴─────┘
`);
{
const line = '─'.repeat(79);
const header = `${' '.repeat(37)}name${' '.repeat(40)}`;
const name = 'very long long long long long long long long long long long ' +
'long long long long';
test([{ name }], `
┌─────────┬──${line}──┐
│ (index) │ ${header}│
├─────────┼──${line}──┤
│ 0 │ '${name}' │
└─────────┴──${line}──┘
`);
}