Commit 48238722 authored by isaacs's avatar isaacs

Join the modern era with classes and arrows and MiniPass

parent 4645b071
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -8,7 +8,8 @@
},
"dependencies": {
"events-to-array": "^1.0.1",
"js-yaml": "^3.2.7"
"js-yaml": "^3.2.7",
"minipass": "^2.2.0"
},
"devDependencies": {
"glob": "^7.0.5",
......@@ -49,9 +50,7 @@
"url": "http://substack.net"
},
"license": "MIT",
"optionalDependencies": {
"readable-stream": "^2"
},
"optionalDependencies": {},
"files": [
"index.js",
"bin/cmd.js",
......
......@@ -11,8 +11,8 @@ parse the [test anything protocol](http://testanything.org/)
# example
``` js
var parser = require('tap-parser');
var p = parser(function (results) {
var Parser = require('tap-parser');
var p = new Parser(function (results) {
console.dir(results);
});
......@@ -81,10 +81,10 @@ Options:
# methods
``` js
var parser = require('tap-parser')
var Parser = require('tap-parser')
```
## var p = parser(options, cb)
## var p = new Parser(options, cb)
Return a writable stream `p` that emits parse events.
......
var t = require('tap')
var Parser = require('../')
t.isa(Parser(), Parser, 'calling as function returns instance')
t.test('passing no options and cb works fine', function (t) {
var p = Parser(t.end)
var p = new Parser(t.end)
p.emit('complete')
})
t.test('end() can take chunk', function (t) {
t.plan(2)
t.test('string', function (t) {
var p = Parser()
var p = new Parser()
p.end('1..0\n', t.end)
})
t.test('encoding', function (t) {
var p = Parser()
var p = new Parser()
p.end(new Buffer('1..0\n').toString('hex'), 'hex', t.end)
})
})
t.test('takes a buffer just fine', function (t) {
var p = Parser(theEnd)
var p = new Parser(theEnd)
p.write(new Buffer('TAP version 13\n'))
var calledme = false
......
......@@ -122,6 +122,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -420,6 +424,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -622,6 +634,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -122,6 +122,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -420,6 +424,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -622,6 +634,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -130,6 +130,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -428,6 +432,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -630,6 +642,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -130,6 +130,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -428,6 +432,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -630,6 +642,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -122,6 +122,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -420,6 +424,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -622,6 +634,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -122,6 +122,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -420,6 +424,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -622,6 +634,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -130,6 +130,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -428,6 +432,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -630,6 +642,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -130,6 +130,10 @@
"extra",
"1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"1..0 # no tests found\n"
......@@ -428,6 +432,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
"ok 1 - boom # time=5.26ms\n"
......@@ -630,6 +642,14 @@
"line",
" 1..0\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" 1..0 # no tests found\n"
],
[
"line",
" ok 1 - boom # time=5.26ms\n"
......
......@@ -19,7 +19,7 @@ setTimeout(function () {
})
t.test('child calling _parse after bailout', function (t) {
var p = Parser()
var p = new Parser()
var etoa = require('events-to-array')
var events = etoa(p, [ 'pipe', 'unpipe', 'prefinish', 'finish', 'line' ])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment