Skip to content

Commit 65aa9f3

Browse files
committed
Merge pull request #46 from thorn0/patch-1
Fix the error with redirecting stdout to a file on Windows
2 parents 79290eb + 3fd012b commit 65aa9f3

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/simpleReporter.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ function actualString(test) {
3434
}
3535

3636
module.exports = through(function(data) {
37-
process.stdout.clearLine();
38-
process.stdout.cursorTo(0);
37+
if (process.stdout.clearLine && process.stdout.cursorTo) {
38+
process.stdout.clearLine();
39+
process.stdout.cursorTo(0);
40+
}
3941

4042
if(data.pass) {
4143
state.pass++;
@@ -49,8 +51,10 @@ module.exports = through(function(data) {
4951
" Got: " + actualString(data) + "\n\n");
5052
}
5153
}, function() {
52-
process.stdout.clearLine();
53-
process.stdout.cursorTo(0);
54+
if (process.stdout.clearLine && process.stdout.cursorTo) {
55+
process.stdout.clearLine();
56+
process.stdout.cursorTo(0);
57+
}
5458
console.log("Ran " + (state.pass + state.fail) + " tests")
5559
console.log(state.pass + " passed")
5660
console.log(state.fail + " failed")

0 commit comments

Comments
 (0)