UNPKG

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