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