From de61d1a64a96fc37c5e29f84c2811ea029ca64ae Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Fri, 11 Nov 2016 12:24:33 +0100 Subject: [PATCH] Don't attempt to clear non-TTY output in simple results reporter Redirecting output currently causes exceptions because `process.stdout.clearLine()` only works for TTYs. This patch inserts a newline instead. --- lib/reporters/simple.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/reporters/simple.js b/lib/reporters/simple.js index bcf59c0..bc7ad02 100644 --- a/lib/reporters/simple.js +++ b/lib/reporters/simple.js @@ -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'); + } } } }