tap-parser
Advanced tools
Comparing version 9.2.0 to 9.3.0
@@ -13,2 +13,3 @@ #!/usr/bin/env node | ||
var omitVersion = false | ||
var strict = false | ||
@@ -20,9 +21,24 @@ function version () { | ||
args.forEach(function (arg, i) { | ||
for (let i = 0; i < args.length; i++) { | ||
const arg = args[i] | ||
if (arg === '-j') { | ||
json = args[i + 1] || 2 | ||
const val = +args[i + 1] | ||
if (val >= 0) { | ||
json = val | ||
i += 1 | ||
} else | ||
json = 2 | ||
continue | ||
} else { | ||
var m = arg.match(/^--json(?:=([0-9]+))$/) | ||
if (m) | ||
json = +m[1] || args[i + 1] || 2 | ||
var m = arg.match(/^--json(?:=([0-9]+))?$/) | ||
if (m) { | ||
if (+m[1] >= 0) | ||
json = +m[1] | ||
else if (+args[i + 1] >= 0) { | ||
json = +args[i + 1] | ||
i += 1 | ||
} else | ||
json = 2 | ||
continue | ||
} | ||
} | ||
@@ -50,12 +66,14 @@ | ||
flat = false | ||
else if (arg === '--strict') | ||
strict = true | ||
else if (arg === '--no-strict') | ||
strict = false | ||
else if (arg === '-s' || arg === '--silent') | ||
json = 'silent' | ||
else | ||
console.error('Unrecognized arg: %j', arg) | ||
} | ||
if (arg === '-v' || arg === '--version') | ||
console.log(require('../package.json').version) | ||
}) | ||
function usage () { | ||
console.log(function () {/* | ||
Usage: | ||
console.log(`Usage: | ||
tap-parser <options> | ||
@@ -65,3 +83,3 @@ | ||
in the format specified by the options. Default output is | ||
uses node's `util.format()` method. | ||
uses node's \`util.inspect()\` method. | ||
@@ -80,4 +98,15 @@ Options: | ||
-b | --bail | ||
Emit a `Bail out!` at the first failed test point encountered | ||
Emit a \`Bail out!\` at the first failed test point encountered | ||
-B | --no-bail | ||
Do not bail out at the first failed test point encountered | ||
(Default) | ||
-f | --flat | ||
Flatten all assertions to the top level parser | ||
-F | --no-flat | ||
Do not flatten all assertions to the top level parser | ||
(Default) | ||
-w | --ignore-all-whitespace | ||
@@ -87,5 +116,16 @@ Skip over blank lines outside of YAML blocks | ||
-o | --omit-version | ||
Ignore the `TAP version 13` line at the start of tests | ||
*/}.toString().split('\n').slice(1, -1).join('\n')) | ||
Ignore the \`TAP version 13\` line at the start of tests | ||
--strict | ||
Run the parser in strict mode | ||
--no-strict | ||
Do not run the parser in strict mode | ||
-s | --silent | ||
Do not print output, just exit success/failure based on TAP stream | ||
`) | ||
// prevent the EPIPE upstream when the data drops on the floor | ||
/* istanbul ignore else */ | ||
if (!process.stdin.isTTY) | ||
@@ -124,3 +164,3 @@ process.stdin.resume() | ||
case 'bailout': | ||
var r = item[1] === true ? '' : (' ' + item[1]) | ||
var r = item[1] ? (' ' + item[1]) : '' | ||
return 'Bail out!' + r + '\n' | ||
@@ -168,3 +208,4 @@ | ||
preserveWhitespace: preserveWhitespace, | ||
omitVersion: omitVersion | ||
omitVersion: omitVersion, | ||
strict: strict, | ||
} | ||
@@ -191,3 +232,2 @@ | ||
process.stdin.pipe(parser) | ||
if (json === 'lines') | ||
@@ -197,7 +237,10 @@ parser.on('line', function (l) { | ||
}) | ||
else | ||
process.on('exit', function () { | ||
process.on('exit', function () { | ||
if (json !== 'silent' && json !== 'lines') | ||
console.log(format(events)) | ||
if (!parser.ok) | ||
process.exit(1) | ||
}) | ||
if (!parser.ok) | ||
process.exit(1) | ||
}) | ||
process.stdin.pipe(parser) |
{ | ||
"name": "tap-parser", | ||
"version": "9.2.0", | ||
"version": "9.3.0", | ||
"description": "parse the test anything protocol", | ||
@@ -61,3 +61,6 @@ "main": "index.js", | ||
"check-coverage": true | ||
}, | ||
"nyc": { | ||
"hookRunInThisContext": true | ||
} | ||
} |
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
45442
1073