[Pkg-javascript-commits] [node-tap-mocha-reporter] 32/137: report plan failures properly
Bastien Roucariès
rouca at moszumanska.debian.org
Thu Sep 7 09:49:23 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 3706ef8e488b4003d840ab443ff652974f797120
Author: isaacs <i at izs.me>
Date: Sun Apr 26 11:44:51 2015 -0700
report plan failures properly
---
lib/runner.js | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/lib/runner.js b/lib/runner.js
index 771357f..30e1c98 100644
--- a/lib/runner.js
+++ b/lib/runner.js
@@ -92,7 +92,7 @@ function attachEvents (runner, parser, level) {
parser.on('version', function (v) {
runner.emit('version', v)
})
- parser.on('finish', function () {
+ parser.on('complete', function (res) {
runner.emit('end')
})
}
@@ -103,6 +103,30 @@ function attachEvents (runner, parser, level) {
parser.name = ''
parser.doingChild = null
+ parser.on('complete', function (res) {
+ if (!res.ok) {
+ var fail = { ok: false, diag: {} }
+ var count = res.count
+ if (res.plan) {
+ var plan = res.plan.end - res.plan.start + 1
+ if (count !== plan) {
+ fail.name = 'test count !== plan'
+ fail.diag = {
+ found: count,
+ wanted: plan
+ }
+ } else {
+ // probably handled on child parser
+ return
+ }
+ } else {
+ fail.name = 'missing plan'
+ }
+ fail.diag.results = res
+ emitTest(parser, fail)
+ }
+ })
+
parser.on('child', function (child) {
//console.log('>>> child')
child.parent = parser
--
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