Socket
Socket
Sign inDemoInstall

tap-parser

Package Overview
Dependencies
Maintainers
2
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-parser - npm Package Compare versions

Comparing version 3.0.5 to 4.0.0

78

index.js

@@ -29,2 +29,3 @@ // Transforms a stream of TAP into a stream of result objects

version: /^TAP version ([0-9]+)\n$/i,
childVersion: /^( )+TAP version ([0-9]+)\n$/i,
plan: /^([0-9]+)\.\.([0-9]+)(?:\s+(?:#\s*(.*)))?\n$/,

@@ -123,3 +124,8 @@ subtest: /^# Subtest(?:: (.*))?\n$/,

this.buffer = ''
this.bail = !!options.bail
this.bailingOut = false
this.bailedOut = false
this.syntheticBailout = false
this.syntheticPlan = false
this.omitVersion = !!options.omitVersion
this.planStart = -1

@@ -319,2 +325,11 @@ this.planEnd = -1

if (this.syntheticBailout && this.level === 0) {
var reason = this.bailedOut
if (reason === true)
reason = ''
else
reason = ' ' + reason
this.emit('line', 'Bail out!' + reason + '\n')
}
var skipAll

@@ -331,2 +346,3 @@

if (this.count === 0) {
this.syntheticPlan = true
this.emit('line', '1..0\n')

@@ -401,9 +417,18 @@ this.plan(1, 0, '', '1..0\n')

Parser.prototype.bailout = function (reason) {
Parser.prototype.bailout = function (reason, synthetic) {
this.syntheticBailout = synthetic
if (this.bailingOut)
return
// Guard because emitting a result can trigger a forced bailout
// if the harness decides that failures should be bailouts.
this.bailingOut = reason || true
this.emitResult()
this.bailedOut = reason || true
this.bailedOut = this.bailingOut
this.ok = false
this.emit('bailout', reason)
if (this.parent)
this.parent.bailout(reason)
this.parent.bailout(reason, true)
}

@@ -453,2 +478,8 @@

this.emit('assert', res)
if (this.bail && !res.ok && !res.todo && !res.skip && !this.bailingOut) {
var ind = new Array(this.level + 1).join(' ')
for (var p = this; p.parent; p = p.parent);
var bailName = res.name ? ' # ' + res.name : ''
p._parse(ind + 'Bail out!' + bailName + '\n')
}
this.clearExtraQueue()

@@ -469,2 +500,5 @@ }

if (indentStream)
this.emit('line', line)
// If we have any other result waiting in the wings, we need to emit

@@ -477,2 +511,3 @@ // that now. A buffered test emits its test point at the *end* of

this.child = new Parser({
bail: this.bail,
parent: this,

@@ -482,2 +517,3 @@ level: this.level + 1,

preserveWhitespace: this.preserveWhitespace,
omitVersion: true,
strict: this.strict

@@ -492,2 +528,11 @@ })

this.child.on('line', function (l) {
if (this.syntheticPlan)
return
if (l.trim() || self.preserveWhitespace)
l = ' ' + l
self.emit('line', l)
})
// Canonicalize the parsing result of any kind of subtest

@@ -541,10 +586,11 @@ // if it's a buffered subtest or a non-indented Subtest directive,

// this is a line we are processing, so emit it
if (this.preserveWhitespace || line.trim() || this.yind)
this.emit('line', line)
if (this.bailedOut)
// If we're bailing out, then the only thing we want to see is the
// end of a buffered child test. Anything else should be ignored.
if (this.bailingOut && !/^\s*}\n$/.test(line))
return
if (line === '\n')
// This allows omitting even parsing the version if the test is
// an indented child test. Several parsers get upset when they
// see an indented version field.
if (this.omitVersion && lineTypes.version.test(line) && !this.yind)
return

@@ -560,2 +606,9 @@

// this is a line we are processing, so emit it
if (this.preserveWhitespace || line.trim() || this.yind)
this.emit('line', line)
if (line === '\n')
return
// buffered subtests must end with a }

@@ -603,3 +656,3 @@ if (this.child && this.child.buffered && line === '}\n') {

if (type[0] === 'bailout') {
this.bailout(type[1][1].trim())
this.bailout(type[1][1].trim(), false)
return

@@ -675,2 +728,3 @@ }

if (line.indexOf(this.yind) === 0) {
this.emit('line', line)
this.yamlishLine(line)

@@ -690,2 +744,3 @@ return

this.yind = indent
this.emit('line', line)
return

@@ -725,2 +780,3 @@ }

if (type[0] === 'comment') {
this.emit('line', line)
this.emitComment(line)

@@ -737,2 +793,4 @@ } else {

// at this point, it's either a non-subtest comment, or garbage.
this.emit('line', line)
if (lineTypes.comment.test(line)) {

@@ -739,0 +797,0 @@ this.emitComment(line)

2

package.json
{
"name": "tap-parser",
"version": "3.0.5",
"version": "4.0.0",
"description": "parse the test anything protocol",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc