Skip to content

Commit 449ee8d

Browse files
mscdextargos
authored andcommitted
console: fix table() output
Fixes: #27915 PR-URL: #27917 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent d982f0b commit 449ee8d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎lib/internal/console/constructor.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ const consoleMethods = {
412412
const opt = {
413413
depth,
414414
maxArrayLength: 3,
415+
breakLength: Infinity,
415416
...this[kGetInspectOptions](this._stdout)
416417
};
417418
return inspect(v, opt);

‎test/parallel/test-console-table.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,17 @@ test([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], `
244244
│ 1 │ 'Z' │ 2 │
245245
└─────────┴─────┴─────┘
246246
`);
247+
248+
{
249+
const line = '─'.repeat(79);
250+
const header = `${' '.repeat(37)}name${' '.repeat(40)}`;
251+
const name = 'very long long long long long long long long long long long ' +
252+
'long long long long';
253+
test([{ name }], `
254+
┌─────────┬──${line}──┐
255+
│ (index) │ ${header}
256+
├─────────┼──${line}──┤
257+
│ 0 │ '${name}' │
258+
└─────────┴──${line}──┘
259+
`);
260+
}

0 commit comments

Comments
 (0)