Skip to content

Commit

Permalink
Include diags for first missing test on plan failures
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Sep 9, 2016
1 parent 58039b1 commit 3971c06
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,16 @@ Test.prototype._end = function (implicit) {
// guard against that with the 'ending' flag
this._ending = true
var missing = this._plan - this._count
var addMissingTestDiag = true
while (missing > 0) {
this.fail('missing test', { at: false })
this.fail('missing test', {
at: false,
plan: this._plan,
count: this._count,
missing: missing,
diagnostic: addMissingTestDiag
})
addMissingTestDiag = false
missing--
}

Expand Down
6 changes: 6 additions & 0 deletions test/test/plan-too-many.tap
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ TAP version 13
{"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
---
{"count":2,"missing":6,"plan":8}
...
not ok 4 - missing test
not ok 5 - missing test
not ok 6 - missing test
Expand All @@ -23,6 +26,9 @@ TAP version 13
...

not ok 4 - missing test
---
{"count":3,"missing":6,"plan":9}
...
not ok 5 - missing test
not ok 6 - missing test
not ok 7 - missing test
Expand Down
6 changes: 6 additions & 0 deletions test/test/throws-and-plans.tap
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ not ok 3 - no assert only throw ___/# time=[0-9.]+(ms)?/~~~
{"at":{"column":11,"file":"test/test/throws-and-plans.js","line":39},"message":"Error: pwnSync","source":"throw new Error('pwnSync')\n","test":"sync thrower"}
...
not ok 3 - missing test
---
{"count":2,"missing":6,"plan":8}
...
not ok 4 - missing test
not ok 5 - missing test
not ok 6 - missing test
Expand All @@ -68,6 +71,9 @@ not ok 3 - no assert only throw ___/# time=[0-9.]+(ms)?/~~~
{"at":{"column":13,"file":"test/test/throws-and-plans.js","line":18},"message":"Error: pwn","source":"throw new Error('pwn')\n","test":"async thrower"}
...
not ok 4 - missing test
---
{"count":3,"missing":5,"plan":8}
...
not ok 5 - missing test
not ok 6 - missing test
not ok 7 - missing test
Expand Down

0 comments on commit 3971c06

Please sign in to comment.