Skip to content

Commit 8449f1c

Browse files
grncdrJames Halliday
authored andcommitted
Add nested-sync-noplan-noend
1 parent 709c36a commit 8449f1c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/nested-sync-noplan-noend.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
var tape = require('../');
2+
var tap = require('tap');
3+
4+
tap.test('nested sync test without plan or end', function (tt) {
5+
tt.plan(1);
6+
7+
var test = tape.createHarness();
8+
var tc = tap.createConsumer();
9+
10+
var rows = [];
11+
tc.on('data', function (r) { rows.push(r) });
12+
tc.on('end', function () {
13+
var rs = rows.map(function (r) {
14+
if (r && typeof r === 'object') {
15+
return { id : r.id, ok : r.ok, name : r.name.trim() };
16+
}
17+
else return r;
18+
});
19+
var expected = [
20+
'TAP version 13',
21+
'nested without plan or end',
22+
'first',
23+
{ id: 1, ok: true, name: '(unnamed assert)' },
24+
'second',
25+
{ id: 2, ok: true, name: '(unnamed assert)' },
26+
'tests 2',
27+
'pass 2',
28+
'ok'
29+
]
30+
tt.same(rs, expected);
31+
});
32+
33+
test.createStream().pipe(tc);
34+
35+
test('nested without plan or end', function(t) {
36+
t.test('first', function(q) {
37+
setTimeout(function first() {
38+
q.ok(true);
39+
q.end()
40+
}, 10);
41+
});
42+
t.test('second', function(q) {
43+
setTimeout(function second() {
44+
q.ok(true);
45+
q.end()
46+
}, 10);
47+
});
48+
});
49+
50+
});

0 commit comments

Comments
 (0)