tap-parser
Advanced tools
Comparing version 5.2.0 to 5.3.0
34
index.js
@@ -123,2 +123,3 @@ // Transforms a stream of TAP into a stream of result objects | ||
this.comments = [] | ||
this.results = null | ||
@@ -420,3 +421,22 @@ this.braceLevel = null | ||
if (!this.results) { | ||
this.results = new FinalResults(!!skipAll, this) | ||
var res = this.results = new FinalResults(!!skipAll, this) | ||
// comment a bit at the end so we know what happened. | ||
// but don't repeat these comments if they're already present. | ||
if (res.plan.end !== res.count && !res.bailout) | ||
this.emitComment('test count(' + res.count + | ||
') != plan(' + res.plan.end + ')', false, true) | ||
if (res.fail > 0 && !res.ok) | ||
this.emitComment('failed ' + res.fail + | ||
(res.count > 1 ? ' of ' + res.count + ' tests' | ||
: ' test'), | ||
false, true) | ||
if (res.todo > 0) | ||
this.emitComment('todo: ' + res.todo, false, true) | ||
if (res.skip > 0) | ||
this.emitComment('skip: ' + res.skip, false, true) | ||
this.emit('complete', this.results) | ||
@@ -681,3 +701,13 @@ } | ||
Parser.prototype.emitComment = function (line, skipLine) { | ||
Parser.prototype.emitComment = function (line, skipLine, noDuplicate) { | ||
if (line.trim().charAt(0) !== '#') | ||
line = '# ' + line | ||
if (line.slice(-1) !== '\n') | ||
line += '\n' | ||
if (noDuplicate && this.comments.indexOf(line) !== -1) | ||
return | ||
this.comments.push(line) | ||
if (this.current || this.extraQueue.length) { | ||
@@ -684,0 +714,0 @@ // no way to get here with skipLine being true |
{ | ||
"name": "tap-parser", | ||
"version": "5.2.0", | ||
"version": "5.3.0", | ||
"description": "parse the test anything protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
41372
953