[Pkg-javascript-commits] [node-tap-mocha-reporter] 74/137: report failed suite with all passing tests

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:28 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 ba1625530ddb4cb8164ac11bee7c8b9642001353
Author: isaacs <i at izs.me>
Date:   Wed Sep 2 16:07:41 2015 -0700

    report failed suite with all passing tests
    
    The better to catch non-zero exit status code where the tap is all
    passing.
---
 lib/runner.js | 7 +++++++
 lib/suite.js  | 1 +
 2 files changed, 8 insertions(+)

diff --git a/lib/runner.js b/lib/runner.js
index b39dccf..339303d 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -186,6 +186,12 @@ function attachEvents (runner, parser, level) {
       if (this.doingChild.name === result.name) {
         if (suite && result.time)
           suite.duration = result.time
+
+        // If it's ok so far, but the ending result is not-ok, then
+        // that means that it exited non-zero.  Emit the test so
+        // that we can print it as a failure.
+        if (suite.ok && !result.ok)
+          emitTest(this, result)
       }
 
       var emitOn = this
@@ -267,6 +273,7 @@ function emitTest (parser, result) {
     //if (test.parent === parser)
     //  test.parent = parser.suite
     parser.suite.tests.push(test)
+    parser.suite.ok = parser.suite.ok && result.ok
   }
 
   runner.emit('test', test)
diff --git a/lib/suite.js b/lib/suite.js
index 270c085..d1ed52c 100644
--- a/lib/suite.js
+++ b/lib/suite.js
@@ -11,6 +11,7 @@ function Suite (parent) {
   this.title = parent.name || ''
   this.suites = []
   this.tests = []
+  this.ok = true
 }
 
 Suite.prototype.fullTitle = function () {

-- 
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