tap-parser
Advanced tools
Comparing version 1.1.4 to 1.1.5
50
index.js
@@ -113,2 +113,3 @@ // Transforms a stream of TAP into a stream of result objects | ||
this.current = null | ||
this.commentQueue = [] | ||
@@ -267,2 +268,9 @@ this.count = 0 | ||
Parser.prototype.clearCommentQueue = function () { | ||
for (var c = 0; c < this.commentQueue.length; c++) { | ||
this.emit('comment', this.commentQueue[c]) | ||
} | ||
this.commentQueue.length = 0 | ||
} | ||
Parser.prototype.emitResult = function () { | ||
@@ -278,3 +286,3 @@ if (this.child) { | ||
if (!this.current) | ||
return | ||
return this.clearCommentQueue() | ||
@@ -300,2 +308,3 @@ var res = this.current | ||
this.emit('assert', res) | ||
this.clearCommentQueue() | ||
} | ||
@@ -327,2 +336,9 @@ | ||
Parser.prototype.emitComment = function (line) { | ||
if (this.current || this.commentQueue.length) | ||
this.commentQueue.push(line) | ||
else | ||
this.emit('comment', line) | ||
} | ||
Parser.prototype._parse = function (line) { | ||
@@ -342,9 +358,2 @@ // normalize line endings | ||
// comment, but let "# Subtest:" comments start a child | ||
var c = line.match(/^(\s+)?#(.*)/) | ||
if (c && !(c[1] && /^ Subtest: /.test(c[2]))) { | ||
this.emit('comment', line) | ||
return | ||
} | ||
var bailout = line.match(/^bail out!(.*)\n$/i) | ||
@@ -368,9 +377,2 @@ if (bailout) { | ||
// if we got a plan at the end, or a 1..0 plan, then we can't | ||
// have any more results, yamlish, or child sets. | ||
if (this.postPlan) { | ||
this.emit('extra', line) | ||
return | ||
} | ||
// still belongs to the child. | ||
@@ -383,2 +385,6 @@ if (this.child) { | ||
} | ||
if (line.trim().charAt(0) === '#') { | ||
this.emitComment(line) | ||
return | ||
} | ||
// a child test can only end when we get an test point line. | ||
@@ -392,2 +398,16 @@ // anything else is extra. | ||
// comment, but let "# Subtest:" comments start a child | ||
var c = line.match(/^(\s+)?#(.*)/) | ||
if (c && !(c[1] && /^ Subtest: /.test(c[2]))) { | ||
this.emitComment(line) | ||
return | ||
} | ||
// if we got a plan at the end, or a 1..0 plan, then we can't | ||
// have any more results, yamlish, or child sets. | ||
if (this.postPlan) { | ||
this.emit('extra', line) | ||
return | ||
} | ||
var indent = line.match(/^[ \t]+/) | ||
@@ -394,0 +414,0 @@ if (indent) { |
{ | ||
"name": "tap-parser", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "parse the test anything protocol", | ||
@@ -16,3 +16,3 @@ "main": "index.js", | ||
"glob": "^5.0.2", | ||
"tap": "~0.4.6", | ||
"tap": "^1.2.0", | ||
"tape": "^3.5.0" | ||
@@ -19,0 +19,0 @@ }, |
@@ -10,2 +10,4 @@ module.exports = | ||
[ 'version', '13' ], | ||
[ 'line', '# debug test\n' ], | ||
[ 'comment', '# debug test\n' ], | ||
[ 'line', 'ok 1 Should output debugger message\n' ], | ||
@@ -16,2 +18,8 @@ [ 'line', '1..1\n' ], | ||
[ 'plan', { start: 1, end: 1 } ], | ||
[ 'line', '# tests 1\n' ], | ||
[ 'comment', '# tests 1\n' ], | ||
[ 'line', '# pass 1\n' ], | ||
[ 'comment', '# pass 1\n' ], | ||
[ 'line', '# ok\n' ], | ||
[ 'comment', '# ok\n' ], | ||
[ 'complete', | ||
@@ -27,3 +35,2 @@ { ok: true, count: 1, pass: 1, plan: { start: 1, end: 1 } } ] ] ], | ||
[ 'line', ' # debug test\n' ], | ||
[ 'comment', ' # debug test\n' ], | ||
[ 'line', ' ok 1 Should output debugger message\n' ], | ||
@@ -33,8 +40,5 @@ [ 'line', ' \n' ], | ||
[ 'line', ' # tests 1\n' ], | ||
[ 'comment', ' # tests 1\n' ], | ||
[ 'line', ' # pass 1\n' ], | ||
[ 'comment', ' # pass 1\n' ], | ||
[ 'line', ' \n' ], | ||
[ 'line', ' # ok\n' ], | ||
[ 'comment', ' # ok\n' ], | ||
[ 'line', 'ok 1 - test/debug-test.js # time=537.383ms\n' ], | ||
@@ -41,0 +45,0 @@ [ 'line', '1..1\n' ], |
@@ -103,2 +103,4 @@ module.exports = | ||
[ 'plan', { start: 1, end: 2 } ], | ||
[ 'line', '# time=174.236ms\n' ], | ||
[ 'comment', '# time=174.236ms\n' ], | ||
[ 'complete', | ||
@@ -150,3 +152,2 @@ { ok: true, count: 2, pass: 2, plan: { start: 1, end: 2 } } ] ] ], | ||
[ 'line', ' # time=174.236ms\n' ], | ||
[ 'comment', ' # time=174.236ms\n' ], | ||
[ 'line', 'ok 1 - test/01c-user-updates.js # time=339.14ms\n' ], | ||
@@ -153,0 +154,0 @@ [ 'line', '1..1\n' ], |
module.exports = | ||
[ [ 'line', 'TAP version 13\n' ], | ||
[ 'version', '13' ], | ||
[ 'line', '# beep\n' ], | ||
[ 'comment', '# beep\n' ], | ||
[ 'line', 'ok should be equal\n' ], | ||
[ 'line', 'ok should be equivalent\n' ], | ||
[ 'assert', { ok: true, id: 1, name: 'should be equal' } ], | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok should be equal\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'should be equivalent' } ], | ||
[ 'line', 'ok (unnamed assert)\n' ], | ||
[ 'assert', { ok: true, id: 3, name: 'should be equal' } ], | ||
[ 'line', '# before 1\n' ], | ||
[ 'comment', '# before 1\n' ], | ||
[ 'line', 'ok one\n' ], | ||
[ 'line', 'ok two\n' ], | ||
[ 'assert', { ok: true, id: 1, name: 'one' } ], | ||
[ 'line', '# before 3\n' ], | ||
[ 'line', 'ok three\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'two' } ], | ||
[ 'comment', '# before 3\n' ], | ||
[ 'line', 'ok four\n' ], | ||
[ 'assert', { ok: true, id: 3, name: 'three' } ], | ||
[ 'line', '# after 4\n' ], | ||
[ 'line', '1..4\n' ], | ||
[ 'assert', { ok: true, id: 4, name: '(unnamed assert)' } ], | ||
[ 'assert', { ok: true, id: 4, name: 'four' } ], | ||
[ 'comment', '# after 4\n' ], | ||
[ 'plan', { start: 1, end: 4 } ], | ||
@@ -18,0 +20,0 @@ [ 'line', '# tests 4\n' ], |
@@ -42,2 +42,6 @@ module.exports = | ||
plan: { start: 1, end: 0, skipAll: true } } ] ] ], | ||
[ 'line', '# package - Easy package.json exports.\n' ], | ||
[ 'comment', '# package - Easy package.json exports.\n' ], | ||
[ 'line', '## Intro\n' ], | ||
[ 'comment', '## Intro\n' ], | ||
[ 'line', | ||
@@ -55,4 +59,8 @@ 'This module provides an easy way to export package.json data.\n' ], | ||
'find your package.json file automatically. Cool, ugh?\n' ], | ||
[ 'line', '## Installation\n' ], | ||
[ 'comment', '## Installation\n' ], | ||
[ 'line', ' # Subtest: npm install package line\n' ], | ||
[ 'line', ' $ npm install package\n' ], | ||
[ 'line', '## Usage\n' ], | ||
[ 'comment', '## Usage\n' ], | ||
[ 'line', | ||
@@ -65,4 +73,8 @@ ' var package = require(\'package\')(); // contains package.json data.\n' ], | ||
' yourAwesomeModule.version = package.version;\n' ], | ||
[ 'line', '## Contribution\n' ], | ||
[ 'comment', '## Contribution\n' ], | ||
[ 'line', 'Bug fixes and features are welcomed.\n' ], | ||
[ 'extra', 'Bug fixes and features are welcomed.\n' ], | ||
[ 'line', '## Other similar modules\n' ], | ||
[ 'comment', '## Other similar modules\n' ], | ||
[ 'line', | ||
@@ -74,2 +86,4 @@ '- pkginfo (https://github.com/indexzero/node-pkginfo) by indexzero.\n' ], | ||
[ 'extra', '- JSON.parse + fs.readFile\n' ], | ||
[ 'line', '## License\n' ], | ||
[ 'comment', '## License\n' ], | ||
[ 'line', 'MIT License\n' ], | ||
@@ -138,2 +152,4 @@ [ 'extra', 'MIT License\n' ], | ||
[ 'plan', { start: 1, end: 1 } ], | ||
[ 'line', '# time=12.555ms\n' ], | ||
[ 'comment', '# time=12.555ms\n' ], | ||
[ 'complete', | ||
@@ -144,5 +160,3 @@ { ok: true, count: 1, pass: 1, plan: { start: 1, end: 1 } } ] ] ], | ||
[ 'line', ' # package - Easy package.json exports.\n' ], | ||
[ 'comment', ' # package - Easy package.json exports.\n' ], | ||
[ 'line', ' ## Intro\n' ], | ||
[ 'comment', ' ## Intro\n' ], | ||
[ 'line', | ||
@@ -155,7 +169,5 @@ ' This module provides an easy way to export package.json data.\n' ], | ||
[ 'line', ' ## Installation\n' ], | ||
[ 'comment', ' ## Installation\n' ], | ||
[ 'line', ' # Subtest: npm install package line\n' ], | ||
[ 'line', ' $ npm install package\n' ], | ||
[ 'line', ' ## Usage\n' ], | ||
[ 'comment', ' ## Usage\n' ], | ||
[ 'line', | ||
@@ -169,6 +181,4 @@ ' var package = require(\'package\')(); // contains package.json data.\n' ], | ||
[ 'line', ' ## Contribution\n' ], | ||
[ 'comment', ' ## Contribution\n' ], | ||
[ 'line', ' Bug fixes and features are welcomed.\n' ], | ||
[ 'line', ' ## Other similar modules\n' ], | ||
[ 'comment', ' ## Other similar modules\n' ], | ||
[ 'line', | ||
@@ -178,3 +188,2 @@ ' - pkginfo (https://github.com/indexzero/node-pkginfo) by indexzero.\n' ], | ||
[ 'line', ' ## License\n' ], | ||
[ 'comment', ' ## License\n' ], | ||
[ 'line', ' MIT License\n' ], | ||
@@ -214,3 +223,2 @@ [ 'line', ' Copyright (C) 2011 Veselin Todorov\n' ], | ||
[ 'line', ' # time=12.555ms\n' ], | ||
[ 'comment', ' # time=12.555ms\n' ], | ||
[ 'line', 'not ok 1 - index.js # time=201.609ms\n' ], | ||
@@ -217,0 +225,0 @@ [ 'line', ' ---\n' ], |
module.exports = | ||
[ [ 'line', 'TAP version 13\n' ], | ||
[ 'version', '13' ], | ||
[ 'line', '# beep\n' ], | ||
[ 'comment', '# beep\n' ], | ||
[ 'line', '# before 1\n' ], | ||
[ 'comment', '# before 1\n' ], | ||
[ 'line', 'ok 1 should be equal\n' ], | ||
[ 'line', 'ok 2 should be equivalent\n' ], | ||
[ 'assert', { ok: true, id: 1, name: 'should be equal' } ], | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', '# before 3\n' ], | ||
[ 'line', 'ok 3 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'should be equivalent' } ], | ||
[ 'comment', '# before 3\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -14,0 +14,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
module.exports = | ||
[ [ 'line', 'TAP version 13\n' ], | ||
[ 'version', '13' ], | ||
[ 'line', '# beep\n' ], | ||
[ 'comment', '# beep\n' ], | ||
[ 'line', '# before 1\n' ], | ||
[ 'comment', '# before 1\n' ], | ||
[ 'line', 'ok 1 should be equal\n' ], | ||
[ 'line', 'ok 2 should be equivalent\n' ], | ||
[ 'assert', { ok: true, id: 1, name: 'should be equal' } ], | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', '# before 3\n' ], | ||
[ 'line', 'ok 3 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'should be equivalent' } ], | ||
[ 'comment', '# before 3\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -14,0 +14,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
@@ -9,3 +9,2 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 3 - should be equal\n' ], | ||
@@ -17,2 +16,3 @@ [ 'assert', | ||
name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 4 - (unnamed assert)\n' ], | ||
@@ -19,0 +19,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 3 should be equal\n' ], | ||
[ 'assert', { ok: false, id: 2, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 10 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 9, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 11 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 10, name: 'should be equal' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 10 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 9, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 11 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 10, name: 'should be equal' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 3 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 2 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 3, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 2, name: 'should be equal' } ], |
@@ -8,6 +8,6 @@ module.exports = | ||
[ 'line', '# $^0 is solaris\n' ], | ||
[ 'comment', '# $^0 is solaris\n' ], | ||
[ 'line', 'ok 2 - # SKIP no /sys directory\n' ], | ||
[ 'assert', | ||
{ ok: true, id: 1, name: 'approved operating system' } ], | ||
[ 'comment', '# $^0 is solaris\n' ], | ||
[ 'line', 'ok 3 - # SKIP no /sys directory\n' ], | ||
@@ -14,0 +14,0 @@ [ 'assert', { ok: true, id: 2, skip: 'no /sys directory' } ], |
@@ -10,5 +10,5 @@ module.exports = | ||
[ 'line', '# boop\n' ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 3 should be equal\n' ], | ||
[ 'assert', { ok: true, id: 2, name: 'should be equivalent' } ], | ||
[ 'comment', '# boop\n' ], | ||
[ 'line', 'ok 4 (unnamed assert)\n' ], | ||
@@ -15,0 +15,0 @@ [ 'assert', { ok: true, id: 3, name: 'should be equal' } ], |
@@ -6,6 +6,6 @@ module.exports = | ||
[ 'line', '# need to ping 6 servers\n' ], | ||
[ 'comment', '# need to ping 6 servers\n' ], | ||
[ 'line', 'ok 2 - pinged diamond\n' ], | ||
[ 'assert', | ||
{ ok: true, id: 1, name: 'retrieving servers from the database' } ], | ||
[ 'comment', '# need to ping 6 servers\n' ], | ||
[ 'line', 'ok 3 - pinged ruby\n' ], | ||
@@ -12,0 +12,0 @@ [ 'assert', { ok: true, id: 2, name: 'pinged diamond' } ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
254351
85
5250