[Pkg-javascript-commits] [node-tap-mocha-reporter] 41/137: Capture timing data from nested child tests

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:24 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 2c394c6a717b763d3cf66b4ae76aa5d2cddfb0f9
Author: isaacs <i at izs.me>
Date:   Wed Apr 29 15:52:52 2015 -0400

    Capture timing data from nested child tests
---
 lib/runner.js | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/runner.js b/lib/runner.js
index 6605e86..109d691 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -170,10 +170,18 @@ function attachEvents (runner, parser, level) {
 
     // no need to print the trailing assert for subtests
     // we've already emitted a 'suite end' event for this.
-    if (this.doingChild && this.doingChild.didAssert &&
-        this.doingChild.name === result.name) {
+    if (this.doingChild) {
+      var suite = this.doingChild.suite
+      if (this.doingChild.didAssert &&
+          this.doingChild.name === result.name) {
+        if (suite && result.time)
+          suite.duration = result.time
+      }
       this.doingChild = null
-      return
+      if (suite) {
+        runner.emit('suite end', suite)
+        return
+      }
     }
 
     this.didAssert = true
@@ -184,8 +192,6 @@ function attachEvents (runner, parser, level) {
 
   parser.on('complete', function (results) {
     this.results = results
-    if (this.suite)
-      runner.emit('suite end', this.suite)
   })
 
   parser.on('bailout', function (reason) {

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