Skip to content

Commit

Permalink
Produce output for unfinished tests in buffered mode
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Dec 30, 2016
1 parent 81d35e1 commit 00dae08
Show file tree
Hide file tree
Showing 9 changed files with 238 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ process.on('exit', function (code) {

tap.pipe = function () {
didPipe = true
tap._runChild = Test.prototype._runChild
tap.push = Test.prototype.push
tap.pipe = Test.prototype.pipe
process.on('uncaughtException', onUncaught)
Expand All @@ -52,6 +53,11 @@ function pipe () {
tap.pipe(process.stdout)
}

tap._runChild = function _runChild () {
pipe()
return tap._runChild.apply(tap, arguments)
}

tap.push = function push () {
pipe()
return tap.push.apply(tap, arguments)
Expand Down
19 changes: 19 additions & 0 deletions test/test/plan-too-many-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
TAP version 13
not ok 1 - children plan too big {
1..9
ok 1 - this is ok
ok 2 - i am ok with how this is proceeding
not ok 3 - grandchild {
1..8
ok 1 - i am planning big things
not ok 2 - test unfinished: grandchild
---
{"at":{"column":5,"file":"test/test/plan-too-many.js","line":7},"count":1,"plan":8,"source":"t.test('grandchild', function (tt) {\n"}
...
Bail out! # test unfinished: grandchild
}

Bail out! # test unfinished: grandchild
}

Bail out! # test unfinished: grandchild

35 changes: 35 additions & 0 deletions test/test/plan-too-many-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
TAP version 13
not ok 1 - children plan too big {
1..9
ok 1 - this is ok
ok 2 - i am ok with how this is proceeding
not ok 3 - grandchild {
1..8
ok 1 - i am planning big things
not ok 2 - test unfinished: grandchild
---
{"at":{"column":5,"file":"test/test/plan-too-many.js","line":7},"count":1,"plan":8,"source":"t.test('grandchild', function (tt) {\n"}
...
not ok 3 - missing test
not ok 4 - missing test
not ok 5 - missing test
not ok 6 - missing test
not ok 7 - missing test
not ok 8 - missing test
# failed 7 of 8 tests
___/# time=[0-9.]+(ms)?/~~~
}

not ok 4 - missing test
not ok 5 - missing test
not ok 6 - missing test
not ok 7 - missing test
not ok 8 - missing test
not ok 9 - missing test
# failed 7 of 9 tests
___/# time=[0-9.]+(ms)?/~~~
}

1..1
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~

22 changes: 22 additions & 0 deletions test/test/throw-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
TAP version 13
not ok 1 - nesting {
1..3
ok 1 - first {
1..2
ok 1 - true is ok
ok 2 - doag is also okay
___/# time=[0-9.]+(ms)?/~~~
}

not ok 2 - async thrower {
not ok 1 - Error: THINK FAST! and also lines so many
---
{"at":{"column":16,"file":"test/test/throw.js","line":12},"jerk":true,"message":"Error: THINK FAST!\nand also lines\nso many","source":"var er = new Error('THINK FAST!\\nand also lines\\nso many')\n","test":"async thrower"}
...
Bail out! # Error: THINK FAST! and also lines so many
}

Bail out! # Error: THINK FAST! and also lines so many
}

Bail out! # Error: THINK FAST! and also lines so many

36 changes: 36 additions & 0 deletions test/test/throw-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
TAP version 13
not ok 1 - nesting {
1..3
ok 1 - first {
1..2
ok 1 - true is ok
ok 2 - doag is also okay
___/# time=[0-9.]+(ms)?/~~~
}

not ok 2 - async thrower {
not ok 1 - Error: THINK FAST! and also lines so many
---
{"at":{"column":16,"file":"test/test/throw.js","line":12},"jerk":true,"message":"Error: THINK FAST!\nand also lines\nso many","source":"var er = new Error('THINK FAST!\\nand also lines\\nso many')\n","test":"async thrower"}
...
1..1
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~
}

not ok 3 - thrower {
# failed 2 of 3 tests
___/# time=[0-9.]+(ms)?/~~~
}

ok 2 - this passes
not ok 3 - this fails
---
{"at":{"column":3,"file":"test/test/throw.js","line":25},"source":"t.fail('this fails')\n"}
...
not ok 4 - async kid {
1..2
Bail out! # cannot continue
}

Bail out! # cannot continue

15 changes: 15 additions & 0 deletions test/test/unfinished-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
TAP version 13
not ok 1 - t1 {
not ok 1 - t11 {
1..1
not ok 1 - test unfinished: t11
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":4},"count":0,"plan":1,"source":"t.test('t11', function (t) {\n"}
...
Bail out! # test unfinished: t11
}

Bail out! # test unfinished: t11
}

Bail out! # test unfinished: t11

56 changes: 56 additions & 0 deletions test/test/unfinished-buffer.tap
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
TAP version 13
not ok 1 - t1 {
not ok 1 - t11 {
1..1
not ok 1 - test unfinished: t11
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":4},"count":0,"plan":1,"source":"t.test('t11', function (t) {\n"}
...
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~
}

not ok 2 - test point left in queue: ok - this would be ok if it ever happened
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":17},"source":"t.ok(true, 'this would be ok if it ever happened')\n","test":"t1"}
...
1..2
# failed 2 of 2 tests
___/# time=[0-9.]+(ms)?/~~~
}

not ok 2 - test point left in queue: ok - 1 === 1
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":21},"source":"tap.equal(1, 1, '1 === 1')\n"}
...
not ok 3 - test point left in queue: ok - expect truthy value
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":22},"source":"tap.ok('this is ok')\n"}
...
not ok 4 - test point left in queue: not ok - failsome
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":23},"hoo":"hah","source":"tap.fail('failsome', { hoo: 'hah' })\n"}
...
not ok 5 - spawn left in queue: spawny
---
{"args":["___/.*/~~~unfinished.js"],"at":{"column":5,"file":"test/test/unfinished.js","line":25},"command":"___/.*(node|iojs)(.exe)?/~~~","options":{},"rar":"grr","source":"tap.spawn('___/.*(node|iojs)(.exe)?/~~~', [__filename], {}, 'spawny', { rar: 'grr' })\n"}
...
not ok 6 - spawn left in queue: ___/.*(node|iojs)(.exe)?/~~~ --version
---
{"args":["--version"],"at":{"column":5,"file":"test/test/unfinished.js","line":26},"command":"___/.*(node|iojs)(.exe)?/~~~","options":{},"rar":"grr","source":"tap.spawn('___/.*(node|iojs)(.exe)?/~~~', ['--version'], {}, '', { rar: 'grr' })\n"}
...
not ok 7 - child test left in queue: (unnamed test)
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":28},"source":"tap.test(function (t) {\n"}
...
not ok 8 - child test left in queue: (unnamed test)
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":32},"source":"tap.test('', function (t) {\n"}
...
not ok 9 - child test left in queue: t2
---
{"at":{"column":5,"file":"test/test/unfinished.js","line":36},"source":"tap.test('t2', function (t) {\n"}
...
1..9
# failed 9 of 9 tests
___/# time=[0-9.]+(ms)?/~~~

21 changes: 21 additions & 0 deletions test/test/unfinished-promise-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TAP version 13
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
1..2
ok 1 - ok
not ok 2 - test unfinished: grandchild
---
{"at":{"column":14,"file":"test/test/unfinished-promise.js","line":4},"count":1,"plan":2,"source":"return t.test('grandchild', function (t) {\n"}
...
Bail out! # test unfinished: grandchild
}

Bail out! # test unfinished: grandchild
}

Bail out! # test unfinished: grandchild
}

Bail out! # test unfinished: grandchild

28 changes: 28 additions & 0 deletions test/test/unfinished-promise-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
TAP version 13
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
1..2
ok 1 - ok
not ok 2 - test unfinished: grandchild
---
{"at":{"column":14,"file":"test/test/unfinished-promise.js","line":4},"count":1,"plan":2,"source":"return t.test('grandchild', function (t) {\n"}
...
# failed 1 of 2 tests
___/# time=[0-9.]+(ms)?/~~~
}

1..1
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~
}

1..1
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~
}

1..1
# failed 1 of 1 tests
___/# time=[0-9.]+(ms)?/~~~

0 comments on commit 00dae08

Please sign in to comment.