Name: js-handler/node_modules/nodeunit/examples/nested/nested_reporter_test.unit.js
| 1: | var testCase = require('nodeunit').testCase; |
| 2: | /* |
| 3: | This is an example test suite to demonstrate the nested test reporter. |
| 4: | Run with --reporter nested, e.g., |
| 5: | nodeunit --reporter nested nested_reporter_test.unit.js |
| 6: | |
| 7: | The test output should be something like: |
| 8: | |
| 9: | nested_reporter_test.unit.js |
| 10: | Test 0.1 (pass) |
| 11: | TC 1 |
| 12: | TC 1.1 |
| 13: | Test 1.1.1 (pass) |
| 14: | TC 2 |
| 15: | TC 2.1 |
| 16: | TC 2.1.1 |
| 17: | Test 2.1.1.1 (pass) |
| 18: | Test 2.1.1.2 (pass) |
| 19: | TC 2.2.1 |
| 20: | Test 2.2.1.1 (pass) |
| 21: | TC 2.2.1.1 |
| 22: | Test 2.2.1.1.1 (pass) |
| 23: | Test 2.2.1.2 (pass) |
| 24: | TC 3 |
| 25: | TC 3.1 |
| 26: | TC 3.1.1 |
| 27: | Test 3.1.1.1 (should fail) (fail) ✖ |
| 28: | AssertionError: false == true |
| 29: | // stack trace here. |
| 30: | |
| 31: | FAILURES: 1/8 assertions failed (6ms) |
| 32: | */ |
| 33: | |
| 34: | module.exports = testCase({ |
| 35: | "Test 0.1": function(test) { |
| 36: | test.ok(true); |
| 37: | test.done(); |
| 38: | }, |
| 39: | |
| 40: | "TC 1": testCase({ |
| 41: | "TC 1.1": testCase({ |
| 42: | "Test 1.1.1": function(test) { |
| 43: | test.ok(true); |
| 44: | test.done(); |
| 45: | } |
| 46: | }) |
| 47: | }), |
| 48: | |
| 49: | "TC 2": testCase({ |
| 50: | "TC 2.1": testCase({ |
| 51: | "TC 2.1.1": testCase({ |
| 52: | "Test 2.1.1.1": function(test) { |
| 53: | test.ok(true); |
| 54: | test.done(); |
| 55: | }, |
| 56: | |
| 57: | "Test 2.1.1.2": function(test) { |
| 58: | test.ok(true); |
| 59: | test.done(); |
| 60: | } |
| 61: | }), |
| 62: | |
| 63: | "TC 2.2.1": testCase({ |
| 64: | "Test 2.2.1.1": function(test) { |
| 65: | test.ok(true); |
| 66: | test.done(); |
| 67: | }, |
| 68: | |
| 69: | "TC 2.2.1.1": testCase({ |
| 70: | "Test 2.2.1.1.1": function(test) { |
| 71: | test.ok(true); |
| 72: | test.done(); |
| 73: | }, |
| 74: | }), |
| 75: | |
| 76: | "Test 2.2.1.2": function(test) { |
| 77: | test.ok(true); |
| 78: | test.done(); |
| 79: | } |
| 80: | }) |
| 81: | }) |
| 82: | }), |
| 83: | |
| 84: | "TC 3": testCase({ |
| 85: | "TC 3.1": testCase({ |
| 86: | "TC 3.1.1": testCase({ |
| 87: | "Test 3.1.1.1 (should fail)": function(test) { |
| 88: | test.ok(false); |
| 89: | test.done(); |
| 90: | } |
| 91: | }) |
| 92: | }) |
| 93: | }) |
| 94: | }); |
