Skip to content

Commit

Permalink
Disable progress and ANSI output
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypercubed committed May 28, 2016
1 parent 8dd32ca commit fc3fd51
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
18 changes: 13 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
var showAnsi = false
var showProgress = false

var through = require('through2')
var duplexer = require('duplexer2')
var parser = require('tap-out')
var format = require('ansi-escape')
var format = showAnsi ? require('ansi-escape') : require('./no-ansi')
var symbols = require('figures')
var prettyMs = require('pretty-ms')
var LF = '\n'
Expand Down Expand Up @@ -29,17 +32,23 @@ module.exports = function () {
},
start: new Date(),
}
output.push(LF + format.cha.eraseLine.escape('# ' + test.title))
if (showProgress) {
output.push(LF + format.cha.eraseLine.escape('# ' + test.title))
}
})

tap.on('pass', function () {
++test.pass
output.push(format.cha.eraseLine.escape('# ' + test.title))
if (showProgress) {
output.push(format.cha.eraseLine.escape('# ' + test.title))
}
})

tap.on('fail', function () {
++test.fail
output.push(format.cha.eraseLine.escape('# ' + test.title))
if (showProgress) {
output.push(format.cha.eraseLine.escape('# ' + test.title))
}
})

tap.on('output', function (res) {
Expand Down Expand Up @@ -163,4 +172,3 @@ function prettifyError(assertion) {
}
return format.cyan.escape(ret.join(LF))
}

18 changes: 18 additions & 0 deletions no-ansi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var LF = '\n'

var escapes = require('ansi-escape/lib/escapes')
var colors = require('ansi-escape/lib/colors')

var escape = function (x) { return x }

Object.keys(colors).forEach(function (key) {
escape[key] = escape
})

Object.keys(escapes).forEach(function (key) {
escape[key] = escape
})

escape.eraseLine.escape = function (x) { return x + LF}

module.exports = escape

0 comments on commit fc3fd51

Please sign in to comment.