Skip to content

Commit

Permalink
console: fix table() output
Browse files Browse the repository at this point in the history
Fixes: #27915

PR-URL: #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>
  • Loading branch information
mscdex authored and targos committed May 31, 2019
1 parent d982f0b commit 449ee8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ const consoleMethods = {
const opt = {
depth,
maxArrayLength: 3,
breakLength: Infinity,
...this[kGetInspectOptions](this._stdout)
};
return inspect(v, opt);
Expand Down
14 changes: 14 additions & 0 deletions test/parallel/test-console-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}β”€β”€β”˜
`);
}

0 comments on commit 449ee8d

Please sign in to comment.