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 11.0.0 to 11.0.1

75

index.js

@@ -7,2 +7,8 @@ 'use strict'

// this isn't for performance or anything, it just confuses vim's
// brace-matching to have these in the middle of functions, and
// i'm too lazy to dig into vim-javascript to fix it.
const OPEN_BRACE_EOL = /\{\s*$/
const SPACE_OPEN_BRACE_EOL = / \{$/
// used by the Parser.parse() method

@@ -47,3 +53,3 @@ const etoa = require('events-to-array')

line = line.replace(/\{\s*$/, '').trim()
line = line.replace(OPEN_BRACE_EOL, '').trim()
const time = line.match(/^time=((?:[1-9][0-9]*|0)(?:\.[0-9]+)?)(ms|s)$/i)

@@ -61,3 +67,3 @@ if (time) {

const type = line.match(/^(todo|skip)\b/i)
const type = line.match(/^(todo|skip)(?:\S*)\b(.*)$/i)
if (!type)

@@ -68,3 +74,3 @@ return false

type[1].toLowerCase(),
line.substring(type[1].length).trim() || true,
type[2].trim() || true,
]

@@ -76,6 +82,7 @@ }

const ok = !parsed[1]
const id = +(parsed[2] || count + 1)
const id = +(parsed[2] || 0)
let buffered = parsed[4]
this.ok = ok
this.id = id
if (parsed[2])
this.id = id

@@ -112,4 +119,4 @@ let rest = parsed[3] || ''

if (/\{\s*$/.test(name)) {
name = name.replace(/\{\s*$/, '')
if (OPEN_BRACE_EOL.test(name)) {
name = name.replace(OPEN_BRACE_EOL, '')
buffered = '{'

@@ -209,5 +216,6 @@ }

}
return (res.ok ? '' : 'not ') + 'ok ' + res.id +
return (res.ok ? '' : 'not ') + 'ok' +
(res.id !== undefined ? ' ' + res.id : '' ) +
(res.name
? ' - ' + esc(res.name).replace(/ \{$/, '')
? ' - ' + esc(res.name).replace(SPACE_OPEN_BRACE_EOL, '')
: '') +

@@ -259,2 +267,3 @@ (res.skip ? ' # SKIP' +

this.pointsSeen = new Map()
this.buffer = ''

@@ -321,6 +330,9 @@ this.bail = !!options.bail

const resId = testPoint[2]
const res = new Result(testPoint, this.count)
if (this.planStart !== -1) {
const lessThanStart = +res.id < this.planStart
const greaterThanEnd = +res.id > this.planEnd
if (resId && this.planStart !== -1) {
const lessThanStart = res.id < this.planStart
const greaterThanEnd = res.id > this.planEnd
if (lessThanStart || greaterThanEnd) {

@@ -336,7 +348,8 @@ if (lessThanStart)

if (res.id) {
if (!this.first || res.id < this.first)
this.first = res.id
if (!this.last || res.id > this.last)
this.last = res.id
if (resId && this.pointsSeen.has(res.id)) {
res.tapError = 'test point id ' + resId + ' appears multiple times'
res.previous = this.pointsSeen.get(res.id)
this.tapError(res)
} else if (resId) {
this.pointsSeen.set(res.id, res)
}

@@ -423,6 +436,3 @@

tapError: 'plan end cannot be less than plan start',
plan: {
start: start,
end: end
}
plan: { start, end },
}, line)

@@ -444,4 +454,17 @@ else

// will be coming.
if (this.count !== 0 || this.planEnd === 0)
if (this.count !== 0 || this.planEnd === 0) {
const seen = new Set()
for (const [id, res] of this.pointsSeen.entries()) {
const tapError = id < start ? 'id less than plan start'
: id > end ? 'id greater than plan end'
: null
if (tapError) {
seen.add(tapError)
res.tapError = tapError
res.plan = { start, end }
this.tapError(res)
}
}
this.postPlan = true
}

@@ -576,10 +599,2 @@ this.emit('line', line)

if (this.ok && !skipAll && this.first !== this.planStart) {
this.tapError('first test id does not match plan start')
}
if (this.ok && !skipAll && this.last !== this.planEnd) {
this.tapError('last test id does not match plan end')
}
this.emitComplete(skipAll)

@@ -586,0 +601,0 @@ if (cb)

4

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

@@ -16,3 +16,3 @@ "main": "index.js",

"glob": "^7.0.5",
"tap": "^15.1.6"
"tap": "^15.2.2"
},

@@ -19,0 +19,0 @@ "scripts": {

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