tap-parser-yaml
Advanced tools
Comparing version 0.7.0 to 0.7.1
@@ -16,3 +16,3 @@ var Writable = require('readable-stream').Writable; | ||
diag_open: /^\s+---$/, | ||
diag_close: /^\s+...$/ | ||
diag_close: /^\s+\.\.\.$/ | ||
}; | ||
@@ -19,0 +19,0 @@ |
{ | ||
"name": "tap-parser-yaml", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"description": "parse the test anything protocol (with yaml diagnostic block parsing)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -16,7 +16,17 @@ var test = require('tape'); | ||
'ok 4 (unnamed assert)', | ||
'1..4', | ||
'# tests 4', | ||
'', | ||
'not ok 5 diag with three chars', | ||
' ---', | ||
' operator: deepEqual', | ||
' expected:', | ||
' {}', | ||
' actual:', | ||
' {foo: "bar"}', | ||
' ...', | ||
'1..5', | ||
'# tests 5', | ||
'# pass 4', | ||
'# fail 1', | ||
'', | ||
'# ok' | ||
'# not ok' | ||
]; | ||
@@ -26,3 +36,3 @@ | ||
expected.comments = [ 'beep', 'boop', 'tests 4', 'pass 4', 'ok' ]; | ||
expected.comments = [ 'beep', 'boop', 'tests 5', 'pass 4', 'fail 1', 'not ok' ]; | ||
@@ -44,3 +54,3 @@ expected.asserts.push({ | ||
}); | ||
expected.asserts.push({ | ||
expected.asserts.push({ | ||
ok: true, | ||
@@ -50,2 +60,7 @@ number: 4, | ||
}); | ||
expected.asserts.push({ | ||
ok: false, | ||
number: 5, | ||
name: 'diag with three chars' | ||
}); | ||
@@ -55,29 +70,34 @@ expected.diags.push({ | ||
}); | ||
expected.diags.push({ | ||
operator: 'deepEqual', | ||
actual: {foo: 'bar'}, | ||
expected: {} | ||
}); | ||
test('simple ok', function (t) { | ||
t.plan(4 * 2 + 1 + 4 + 5 + 1); | ||
t.plan(5 * 2 + 2 + 4 + 5 + 1); | ||
var p = parser(onresults); | ||
p.on('results', onresults); | ||
var asserts = []; | ||
p.on('assert', function (assert) { | ||
asserts.push(assert); | ||
t.same(assert, expected.asserts.shift()); | ||
t.same(assert, expected.asserts.shift(), 'assert should be the same'); | ||
}); | ||
var diags = []; | ||
p.on('diag', function (diag) { | ||
diags.push(diag); | ||
t.same(diag, expected.diags.shift()); | ||
t.same(diag, expected.diags.shift(), 'diag should be the same'); | ||
}); | ||
p.on('plan', function (plan) { | ||
t.same(plan, { start: 1, end: 4 }); | ||
t.same(plan, { start: 1, end: 5 }, 'plan should be the same'); | ||
}); | ||
p.on('comment', function (c) { | ||
t.equal(c, expected.comments.shift()); | ||
t.equal(c, expected.comments.shift(), 'comment should be equal'); | ||
}); | ||
for (var i = 0; i < lines.length; i++) { | ||
@@ -87,9 +107,9 @@ p.write(lines[i] + '\n'); | ||
p.end(); | ||
function onresults (results) { | ||
t.ok(results.ok); | ||
t.same(results.errors, []); | ||
t.same(asserts.length, 4); | ||
t.same(results.asserts, asserts); | ||
t.notOk(results.ok, 'tests should not be ok due to one failed test'); | ||
t.same(results.errors, [], 'errors should be the same'); | ||
t.same(asserts.length, 5, 'asserts length should be the same'); | ||
t.same(results.asserts, asserts, 'asserts should be the same'); | ||
} | ||
}); |
39518
25
1196