tap-parser
Advanced tools
Comparing version 5.0.1 to 5.1.0
48
index.js
@@ -146,3 +146,3 @@ // Transforms a stream of TAP into a stream of result objects | ||
this.buffered = options.buffered || null | ||
this.aborted = false | ||
this.preserveWhitespace = options.preserveWhitespace || false | ||
@@ -327,2 +327,5 @@ | ||
Parser.prototype.write = function (chunk, encoding, cb) { | ||
if (this.aborted) | ||
return | ||
if (typeof encoding === 'string' && encoding !== 'utf8') | ||
@@ -636,2 +639,45 @@ chunk = new Buffer(chunk, encoding) | ||
Parser.prototype.abort = function (message, extra) { | ||
if (this.child) { | ||
var b = this.child.buffered | ||
this.child.abort(message, extra) | ||
if (b) | ||
this.write('\n}\n') | ||
} | ||
var dump | ||
if (extra && Object.keys(extra).length) { | ||
try { | ||
dump = yaml.safeDump(extra).trimRight() | ||
} catch (er) {} | ||
} | ||
var y | ||
if (dump) | ||
y = ' ---\n ' + dump.split('\n').join('\n ') + '\n ...\n' | ||
else | ||
y = '\n' | ||
var n = (this.count || 0) + 1 | ||
if (this.current) | ||
n += 1 | ||
if (this.planEnd !== -1 && this.planEnd < n && this.parent) { | ||
// skip it, let the parent do this. | ||
this.aborted = true | ||
return | ||
} | ||
var ind = '' // new Array(this.level + 1).join(' ') | ||
message = message.replace(/[\n\r\s\t]/g, ' ') | ||
var point = '\nnot ok ' + n + ' - ' + message + '\n' + y | ||
// point = ind + point.trimRight().split('\n').join('\n' + ind) + '\n' | ||
if (this.planEnd === -1) | ||
point += '1..' + n + '\n' | ||
this.write(point) | ||
this.aborted = true | ||
this.end() | ||
} | ||
Parser.prototype.emitComment = function (line, skipLine) { | ||
@@ -638,0 +684,0 @@ if (this.current || this.extraQueue.length) { |
{ | ||
"name": "tap-parser", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "parse the test anything protocol", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40393
931