UNPKG

1.46 kBJavaScriptView Raw
1var tape = require('../');
2var tap = require('tap');
3var concat = require('concat-stream');
4var stripFullStack = require('./common').stripFullStack;
5
6tap.test('nested test, with only nested tests, without top-level plan or end', function (tt) {
7 tt.plan(1);
8
9 var test = tape.createHarness();
10 var tc = function (rows) {
11 tt.same(stripFullStack(rows.toString('utf8')), [
12 'TAP version 13',
13 '# nested without plan or end',
14 'not ok 1 test timed out after 100ms',
15 ' ---',
16 ' operator: fail',
17 ' stack: |-',
18 ' Error: test timed out after 100ms',
19 ' [... stack stripped ...]',
20 ' ...',
21 '# first',
22 'ok 2 should be truthy',
23 '# second',
24 'ok 3 should be truthy',
25 '',
26 '1..3',
27 '# tests 3',
28 '# pass 2',
29 '# fail 1',
30 ].join('\n') + '\n');
31 };
32
33 test.createStream().pipe(concat(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 t.timeoutAfter(100);
50 });
51});