[Pkg-javascript-commits] [node-tap-mocha-reporter] 96/137: update tap-parser, don't double-set the name field

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:30 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 fa4274dfb348972e4540110872ca1386155569c7
Author: isaacs <i at izs.me>
Date:   Thu Aug 18 01:06:28 2016 -0700

    update tap-parser, don't double-set the name field
---
 lib/runner.js | 19 +++++++++----------
 package.json  |  2 +-
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/lib/runner.js b/lib/runner.js
index fb7b340..4b5ea0f 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -120,8 +120,7 @@ function attachEvents (runner, parser, level) {
 
   parser.emittedSuite = false
   parser.didAssert = false
-  parser.printed = false
-  parser.name = ''
+  parser.name = parser.name || ''
   parser.doingChild = null
 
   parser.on('complete', function (res) {
@@ -149,7 +148,6 @@ function attachEvents (runner, parser, level) {
   })
 
   parser.on('child', function (child) {
-    //console.log('>>> child')
     child.parent = parser
     attachEvents(runner, child, level + 1)
 
@@ -163,12 +161,14 @@ function attachEvents (runner, parser, level) {
     this.doingChild = child
   })
 
-  parser.on('comment', function (c) {
-    if (!this.printed && c.match(/^# Subtest: /)) {
-      c = c.trim().replace(/^# Subtest: /, '')
-      this.name = c
-    }
-  })
+  if (!parser.name) {
+    parser.on('comment', function (c) {
+      if (!this.name && c.match(/^# Subtest: /)) {
+        c = c.trim().replace(/^# Subtest: /, '')
+        this.name = c
+      }
+    })
+  }
 
   // Just dump all non-parsing stuff to stderr
   parser.on('extra', function (c) {
@@ -254,7 +254,6 @@ function attachEvents (runner, parser, level) {
 }
 
 function emitSuite (parser) {
-  //console.log('emitSuite', parser.emittedSuite, parser.level, parser.name)
   if (!parser.emittedSuite && parser.name) {
     parser.emittedSuite = true
     var suite = parser.suite = new Suite(parser)
diff --git a/package.json b/package.json
index dea39f2..3045af6 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
     "escape-string-regexp": "^1.0.3",
     "glob": "^7.0.5",
     "js-yaml": "^3.3.1",
-    "tap-parser": "^1.0.4",
+    "tap-parser": "^2.0.0",
     "unicode-length": "^1.0.0"
   },
   "devDependencies": {

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