[Pkg-javascript-commits] [node-tap-mocha-reporter] 52/137: classic: show hierarchy of failed tests

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:25 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 2de94772e35a266ad70660b23137cbd6c73045bc
Author: isaacs <i at izs.me>
Date:   Tue May 5 21:47:25 2015 -0700

    classic: show hierarchy of failed tests
    
    Often the title of a test point only makes sense in the context
    of the suite and parent suites.
---
 lib/reporters/classic.js | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/lib/reporters/classic.js b/lib/reporters/classic.js
index e31a0db..3ad4e91 100644
--- a/lib/reporters/classic.js
+++ b/lib/reporters/classic.js
@@ -245,10 +245,10 @@ function Classic (runner) {
     if (dots < 3)
       dots = 3
     dots = ' ' + new Array(dots).join('.') + ' '
-    if (pass === total)
-      num = Base.color('checkmark', num)
-    else if (fails.length)
+    if (fails.length)
       num = Base.color('fail', num)
+    else if (pass === total)
+      num = Base.color('checkmark', num)
     else
       num = Base.color('pending', num)
 
@@ -261,6 +261,8 @@ function Classic (runner) {
     if (fails.length) {
       var failMsg = ''
       fails.forEach(function (t) {
+        if (t.parent)
+          failMsg += t.parent + '\n'
         failMsg += Base.color('fail', 'not ok ' + t.name) + '\n'
         if (t.diag) {
           var printDiff = false
@@ -348,6 +350,16 @@ function Classic (runner) {
     else if (t.todo)
       todo.push(t)
     else if (!t.ok) {
+      t.parent = []
+      var p = test.parent
+      while (p && p !== currentSuite) {
+        var n  = p.title || p.name || p.fullTitle()
+        if (n)
+          t.parent.unshift(n)
+        p = p.parent
+      }
+      t.parent.shift()
+      t.parent = t.parent.join(' > ')
       fails.push(t)
       hadFails = 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