Skip to content

Commit 2609494

Browse files
committed
Read TTY columns from stream, not stdout
1 parent 6882bd0 commit 2609494

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

lib/reporters/mini.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class MiniReporter {
101101
_test(test) {
102102
const SPINNER_WIDTH = 3;
103103
const PADDING = 1;
104-
let title = cliTruncate(test.title, process.stdout.columns - SPINNER_WIDTH - PADDING);
104+
let title = cliTruncate(test.title, this.stream.columns - SPINNER_WIDTH - PADDING);
105105

106106
if (test.error || test.failing) {
107107
title = colors.error(test.title);
@@ -191,7 +191,7 @@ class MiniReporter {
191191
if (test.error.source) {
192192
status += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';
193193

194-
const excerpt = codeExcerpt(test.error.source, {maxWidth: process.stdout.columns});
194+
const excerpt = codeExcerpt(test.error.source, {maxWidth: this.stream.columns});
195195
if (excerpt) {
196196
status += '\n' + indentString(excerpt, 2) + '\n';
197197
}
@@ -275,7 +275,7 @@ class MiniReporter {
275275
}
276276

277277
section() {
278-
return '\n' + chalk.gray.dim('\u2500'.repeat(process.stdout.columns || 80));
278+
return '\n' + chalk.gray.dim('\u2500'.repeat(this.stream.columns || 80));
279279
}
280280

281281
clear() {
@@ -300,7 +300,7 @@ class MiniReporter {
300300
_update(data) {
301301
let str = '';
302302
let ct = this.statusLineCount;
303-
const columns = process.stdout.columns;
303+
const columns = this.stream.columns;
304304
let lastLine = this.lastLineTracker.lastLine();
305305

306306
// Terminals automatically wrap text. We only need the last log line as seen on the screen.

lib/reporters/verbose.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class VerboseReporter {
131131
if (test.error.source) {
132132
output += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';
133133

134-
const excerpt = codeExcerpt(test.error.source, {maxWidth: process.stdout.columns});
134+
const excerpt = codeExcerpt(test.error.source, {maxWidth: this.stream.columns});
135135
if (excerpt) {
136136
output += '\n' + indentString(excerpt, 2) + '\n';
137137
}
@@ -192,7 +192,7 @@ class VerboseReporter {
192192
}
193193

194194
section() {
195-
return chalk.gray.dim('\u2500'.repeat(process.stdout.columns || 80));
195+
return chalk.gray.dim('\u2500'.repeat(this.stream.columns || 80));
196196
}
197197

198198
write(str) {

0 commit comments

Comments
 (0)