UNPKG

1.4 kBJavaScriptView Raw
1var test = require('../');
2
3var childRan = false;
4
5test('parent', function (t) {
6 t.test('child', function (t) {
7 childRan = true;
8 t.pass('child ran');
9 t.end();
10 });
11 t.end();
12});
13
14test('uncle', function (t) {
15 t.ok(childRan, 'Child should run before next top-level test');
16 t.end();
17});
18
19var grandParentRan = false;
20var parentRan = false;
21var grandChildRan = false;
22test('grandparent', function (t) {
23 t.ok(!grandParentRan, 'grand parent ran twice');
24 grandParentRan = true;
25 t.test('parent', function (t) {
26 t.ok(!parentRan, 'parent ran twice');
27 parentRan = true;
28 t.test('grandchild', function (t) {
29 t.ok(!grandChildRan, 'grand child ran twice');
30 grandChildRan = true;
31 t.pass('grand child ran');
32 t.end();
33 });
34 t.pass('parent ran');
35 t.end();
36 });
37 t.test('other parent', function (t) {
38 t.ok(parentRan, 'first parent runs before second parent');
39 t.ok(grandChildRan, 'grandchild runs before second parent');
40 t.end();
41 });
42 t.pass('grandparent ran');
43 t.end();
44});
45
46test('second grandparent', function (t) {
47 t.ok(grandParentRan, 'grandparent ran');
48 t.ok(parentRan, 'parent ran');
49 t.ok(grandChildRan, 'grandchild ran');
50 t.pass('other grandparent ran');
51 t.end();
52});
53
54// vim: set softtabstop=4 shiftwidth=4: