[Pkg-javascript-commits] [node-tap-mocha-reporter] 28/137: classic: Show progressive output for slow tests on TTYs
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Sep 7 09:49:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-tap-mocha-reporter.
commit 7a8768e1fb84dc699da990f2962fb54a8ff9ac29
Author: isaacs <i at izs.me>
Date: Sun Apr 26 10:38:56 2015 -0700
classic: Show progressive output for slow tests on TTYs
---
lib/reporters/classic.js | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/lib/reporters/classic.js b/lib/reporters/classic.js
index e57fae9..3babbec 100644
--- a/lib/reporters/classic.js
+++ b/lib/reporters/classic.js
@@ -41,6 +41,7 @@ var Base = require('./base')
, color = Base.color
, yaml = require('js-yaml')
, util = require('util')
+ , fancy = Base.useColors
util.inherits(Classic, Base)
@@ -62,6 +63,8 @@ function Classic (runner) {
var fails = []
var total = 0
var pass = 0
+ var tickDots = 0
+ var tickColor = 'checkmark'
runner.on('bailout', function (bailout, suite) {
if (currentSuite)
@@ -75,6 +78,13 @@ function Classic (runner) {
runner.on('suite', function (suite) {
if (!suite.root)
return
+
+ if (fancy) {
+ process.stdout.write(suite.title + ' ')
+ tickDots = 0
+ tickColor = 'checkmark'
+ }
+
currentSuite = suite
tests = []
todo = []
@@ -89,6 +99,9 @@ function Classic (runner) {
if (!suite.root)
return
+ if (fancy)
+ Base.cursor.beginningOfLine()
+
currentSuite = null
var len = 60
var title = suite.title || '(unnamed)'
@@ -142,6 +155,30 @@ function Classic (runner) {
total ++
grandTotal ++
var t = test.result
+ if (fancy) {
+ var max = 57 - currentSuite.title.length
+ if (max < 3)
+ max = 3
+
+ if (tickDots > max) {
+ tickDots = 0
+ Base.cursor.deleteLine()
+ Base.cursor.beginningOfLine();
+ process.stdout.write(currentSuite.title + ' ')
+ }
+ tickDots ++
+
+ if (t.todo &&
+ (tickColor === 'checkmark' || tickColor === 'skip'))
+ tickColor = 'pending'
+ else if (t.skip && tickColor === 'checkmark')
+ tickColor = 'skip'
+ else if (!t.ok)
+ tickColor = 'fail'
+
+ process.stdout.write(Base.color(tickColor, '.'))
+ }
+
if (t.skip) {
skipped += 1
if (t.skip !== true)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap-mocha-reporter.git
More information about the Pkg-javascript-commits
mailing list