Skip to content

Commit

Permalink
Don't attempt to clear non-TTY output in simple results reporter
Browse files Browse the repository at this point in the history
Redirecting output currently causes exceptions because `process.stdout.clearLine()` only works for TTYs. This patch inserts a newline instead.
  • Loading branch information
tschneidereit committed Nov 11, 2016
1 parent 6c34b1b commit de61d1a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/reporters/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,12 @@ function simpleReporter(results) {

function clearPassed() {
if (lastPassed) {
process.stdout.clearLine();
process.stdout.cursorTo(0);
if (process.stdout.isTTY) {
process.stdout.clearLine();
process.stdout.cursorTo(0);
} else {
process.stdout.write('\n');
}
}
}
}
Expand Down

0 comments on commit de61d1a

Please sign in to comment.