Skip to content

Commit 6f727c6

Browse files
committed
Put diagnostics on buffered tests
1 parent 67ae57e commit 6f727c6

31 files changed

+128
-73
lines changed

lib/test.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,11 @@ Test.prototype._runChild = function runChild (child, name, extra, cb) {
598598
child.on('bailout', function (message) {
599599
if (extra.buffered) {
600600
self._currentChild = null
601-
self.fail(child._name, {
602-
_tapChildBuffer: child._buffer,
603-
_tapChildBailed: true
604-
})
601+
extra.at = null
602+
delete extra.stack
603+
extra._tapChildBuffer = child._buffer
604+
extra._tapChildBailed = true
605+
self.fail(child._name, extra)
605606
}
606607
rootBail(self, message)
607608
})
@@ -1081,7 +1082,7 @@ Test.prototype._end = function (implicit) {
10811082
var addMissingTestDiag = true
10821083
while (missing > 0) {
10831084
this.fail('missing test', {
1084-
at: false,
1085+
at: this._calledAt,
10851086
plan: this._plan,
10861087
count: this._count,
10871088
missing: missing,
@@ -1408,10 +1409,6 @@ Test.prototype.printResult = function printResult (ok, message, extra) {
14081409
if (typeof extra.diagnostic === 'boolean') {
14091410
diagnostic = extra.diagnostic
14101411
}
1411-
if (buffer) {
1412-
// XXX remove when parser can handle diags along with buffer
1413-
diagnostic = false
1414-
}
14151412
if (diagnostic) {
14161413
diagnostic = this.writeDiags(extra)
14171414
}
@@ -1462,6 +1459,7 @@ function yamlFilter (propertyName, isRoot, source, target) {
14621459
return !(propertyName === 'todo' ||
14631460
/^_tapChild/.test(propertyName) ||
14641461
propertyName === 'skip' ||
1462+
propertyName === 'bail' ||
14651463
propertyName === 'diagnostic' ||
14661464
propertyName === 'buffered' ||
14671465
(propertyName === 'at' && !source.at))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"signal-exit": "^3.0.0",
3030
"stack-utils": "^0.4.0",
3131
"tap-mocha-reporter": "^3.0.0",
32-
"tap-parser": "^4.1.0",
32+
"tap-parser": "^4.2.2",
3333
"tmatch": "^3.0.0"
3434
},
3535
"keywords": [

test/only-non-tap-output.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,18 @@ function runTest (t) {
2929
ok: true,
3030
message: /\.[\\\/]test[\\\/]only-non-tap-output.js child/,
3131
extra: {
32-
at: {},
33-
results: {},
3432
command: process.execPath,
3533
arguments: {},
36-
skip: 'No tests found'
34+
skip: 'no tests found'
3735
}
3836
},
3937
{
4038
ok: true,
4139
message: /\.[\\\/]test[\\\/]only-non-tap-output.js silent/,
4240
extra: {
43-
at: {},
44-
results: {},
4541
command: process.execPath,
4642
arguments: {},
47-
skip: 'No tests found'
43+
skip: 'no tests found'
4844
}
4945
}
5046
])

test/segv.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,12 @@ var segv =
2121
var expect = [
2222
'TAP version 13',
2323
'# Subtest: ./segv ',
24-
' 1..0',
24+
' 1..0 # no tests found',
2525
'not ok 1 - ./segv # time=',
2626
' ---',
27-
' at:',
28-
' line: ',
29-
' column: ',
30-
' file: test/segv.js',
31-
' results:',
32-
' ok: false',
33-
' count: 0',
34-
' pass: 0',
35-
' fail: 0',
36-
' bailout: false',
37-
' todo: 0',
38-
' skip: 0',
39-
' plan:',
40-
' start: 1',
41-
' end: 0',
42-
' skipAll: true',
43-
' skipReason: \'\'',
44-
' comment: \'\'',
4527
' signal: SIG',
4628
' command: ./segv',
4729
' arguments: []',
48-
' source: |',
49-
' tt.spawn(\'./segv\')',
5030
' ...',
5131
'',
5232
'1..1',

test/test/bail-fail-spawn--bail--buffer.tap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
TAP version 13
22
not ok 1 - bail fail {
3-
not ok 1 - ./test/test/nesting.js {
3+
not ok 1 - ./test/test/nesting.js
4+
---
5+
{"arguments":["/Users/isaacs/dev/js/tap/test/test/nesting.js"],"command":"___/.*(node|iojs)(.exe)?/~~~"}
6+
...
7+
{
48
not ok 1 - nesting {
59
1..2
610
ok 1 - first {

test/test/bail-fail-spawn--buffer.tap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
TAP version 13
22
not ok 1 - bail fail {
3-
not ok 1 - ./test/test/nesting.js {
3+
not ok 1 - ./test/test/nesting.js
4+
---
5+
{"arguments":["/Users/isaacs/dev/js/tap/test/test/nesting.js"],"command":"___/.*(node|iojs)(.exe)?/~~~"}
6+
...
7+
{
48
not ok 1 - nesting {
59
1..2
610
ok 1 - first {

test/test/pending-handles--bail--buffer.tap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
TAP version 13
2-
not ok 1 - ___/.*/~~~pending-handles.js child {
2+
not ok 1 - ___/.*/~~~pending-handles.js child
3+
---
4+
{"arguments":["___/.*/~~~pending-handles.js","child"],"command":"___/.*(node|iojs)(.exe)?/~~~","exitCode":1,"failure":"timeout","timeout":900}
5+
...
6+
{
37
ok 1 - this is ok
48
not ok 2 - timeout!
59
---

test/test/pending-handles--buffer.tap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
TAP version 13
2-
not ok 1 - ___/.*/~~~pending-handles.js child {
2+
not ok 1 - ___/.*/~~~pending-handles.js child
3+
---
4+
{"arguments":["___/.*/~~~pending-handles.js","child"],"command":"___/.*(node|iojs)(.exe)?/~~~","failure":"timeout","signal":"SIGTERM","timeout":900}
5+
...
6+
{
37
ok 1 - this is ok
48
not ok 2 - timeout!
59
---

test/test/plan-too-many--buffer.tap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ not ok 1 - children plan too big {
1313

1414
not ok 3 - missing test
1515
---
16-
{"count":2,"missing":6,"plan":8}
16+
{"at":{"column":5,"file":"test/test/plan-too-many.js","line":7},"count":2,"missing":6,"plan":8,"source":"t.test('grandchild', function (tt) {\n"}
1717
...
1818

1919
not ok 4 - missing test
@@ -26,7 +26,7 @@ not ok 1 - children plan too big {
2626

2727
not ok 4 - missing test
2828
---
29-
{"count":3,"missing":6,"plan":9}
29+
{"at":{"column":3,"file":"test/test/plan-too-many.js","line":3},"count":3,"missing":6,"plan":9,"source":"t.test('children plan too big', function (t) {\n"}
3030
...
3131

3232
not ok 5 - missing test

test/test/plan-too-many.tap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ TAP version 13
1313

1414
not ok 3 - missing test
1515
---
16-
{"count":2,"missing":6,"plan":8}
16+
{"at":{"column":5,"file":"test/test/plan-too-many.js","line":7},"count":2,"missing":6,"plan":8,"source":"t.test('grandchild', function (tt) {\n"}
1717
...
1818

1919
not ok 4 - missing test
@@ -26,7 +26,7 @@ TAP version 13
2626

2727
not ok 4 - missing test
2828
---
29-
{"count":3,"missing":6,"plan":9}
29+
{"at":{"column":3,"file":"test/test/plan-too-many.js","line":3},"count":3,"missing":6,"plan":9,"source":"t.test('children plan too big', function (t) {\n"}
3030
...
3131

3232
not ok 5 - missing test

0 commit comments

Comments
 (0)