Name: js-handler/node_modules/nodeunit/node_modules/tap/test/output-childtest-description.js 
1:
var tap  =  require("../")
2:
  , fs   =  require("fs")
3:
  , path =  require('path')
4:
  , cp   =  require("child_process")
5:
  , nestedTests =
6:
      [ "var test = require('..').test"
7:
      , "test('parent test description', function (t) {"
8:
      , " t.plan(2)"
9:
      , " t.ok(true, 'test in parent')"
10:
      , " t.test('child test description', function (t) {"
11:
      , "    t.plan(1)"
12:
      , "    t.ok(true, 'test in child')  "
13:
      , " })"
14:
      , "})"
15:
      ].join("\n")
16:
  , nestedTestsFile = path.join(__dirname, "nested-tests-fixture.js")
17:
 
18:
fs.writeFileSync(nestedTestsFile, nestedTests, "utf8")
19:
console.log(nestedTestsFile);
20:
 
21:
tap.test("nested tests, parent and child pass", function (t) {
22:
  /*
23:
   * Ensure the output includes the following lines in the right order:
24:
   * '# parent test description'
25:
   *   'ok 1 test in parent'
26:
   * '# child test description'
27:
   *   'ok 2 test in child'
28:
   */
29:
 
30:
  t.plan(5)
31:
 
32:
  cp.exec("node " + nestedTestsFile, function (err, stdo, stde) {
33:
    var lines = stdo.split("\n")
34:
      , parentDes =  lines.indexOf("# parent test description")
35:
      , parentRes =  lines.indexOf("ok 1 test in parent")
36:
      , childDes  =  lines.indexOf("# child test description")
37:
      , childRes  =  lines.indexOf("ok 2 test in child")
38:
 
39:
    t.notEqual(parentDes, -1, "outputs parent description")
40:
    t.notEqual(childDes, -1, "outputs child description")
41:
 
42:
    t.ok(parentDes < parentRes ,  "outputs parent description before parent result")
43:
    t.ok(parentRes < childDes  ,  "outputs parent result before child description")
44:
    t.ok(childDes  < childRes  ,  "outputs child description before child result")
45:
 
46:
    fs.unlinkSync(nestedTestsFile);
47:
    t.end()
48:
  })
49:
})