[Pkg-javascript-commits] [node-tap-mocha-reporter] 66/137: Better handling for assertion-less tests (ie, skipped sets)

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:27 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 d59301fbb1ec929107827837dde84469598d2db6
Author: isaacs <i at izs.me>
Date:   Wed Jun 10 02:13:06 2015 -0700

    Better handling for assertion-less tests (ie, skipped sets)
---
 lib/runner.js | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/lib/runner.js b/lib/runner.js
index 3e0c141..b39dccf 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -180,18 +180,38 @@ function attachEvents (runner, parser, level) {
 
     // no need to print the trailing assert for subtests
     // we've already emitted a 'suite end' event for this.
+    // UNLESS, there were no other asserts, AND it's root level
     if (this.doingChild) {
       var suite = this.doingChild.suite
-      if (this.doingChild.didAssert &&
-          this.doingChild.name === result.name) {
+      if (this.doingChild.name === result.name) {
         if (suite && result.time)
           suite.duration = result.time
       }
+
+      var emitOn = this
+      var dc = this.doingChild
       this.doingChild = null
-      if (suite) {
-        runner.emit('suite end', suite)
+
+      if (!dc.didAssert && dc.level === 1) {
+        emitOn = dc
+      } else if (dc.didAssert) {
+        if (dc.suite)
+          runner.emit('suite end', dc.suite)
         return
+      } else {
+        emitOn = this
+      }
+
+      emitSuite(emitOn)
+      emitTest(emitOn, result)
+      if (emitOn !== this && emitOn.suite) {
+        runner.emit('suite end', emitOn.suite)
+        delete emitOn.suite
+      }
+      if (dc.suite) {
+        runner.emit('suite end', dc.suite)
       }
+      return
     }
 
     this.didAssert = 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