Skip to content

Commit

Permalink
output tests for consuming static child test output
Browse files Browse the repository at this point in the history
Simulates cases where the 'TAP_etc' environs aren't handled in any sort
of way in the child process test.

Particularly, the output for bail-on-failure and buffered parent when
the non-buffered non-bail-on-fail child has a failure midstream, is not
very ideal.  Printing the extra data is debatably valuable, but the fact
that it lists the test name as the bailout reason rather than the original
failure is very unfortunate.

Ideally, it'd be treated just like when a non-child-process test bails out.
  • Loading branch information
isaacs committed Jan 3, 2017
1 parent 9ea5a52 commit c40ed06
Show file tree
Hide file tree
Showing 15 changed files with 315 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test/child-text-buffer-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-buffer.js buffer {
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}
Bail out! # ___/.*/~~~child-text-buffer.js buffer

11 changes: 11 additions & 0 deletions test/test/child-text-buffer-bail.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-buffer.js buffer
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
ok 1 - this is fine
not ok 2 - burn
1..2
Bail out! # burn
Bail out! # burn

24 changes: 24 additions & 0 deletions test/test/child-text-buffer-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-buffer.js buffer {
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}

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

25 changes: 25 additions & 0 deletions test/test/child-text-buffer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if (process.argv[2] === 'buffer') {
console.log(function () { /*
TAP version 13
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
*/}.toString().split('\n').slice(1, -1).join('\n'))
} else {
var t = require('../..')
var extra = { diagnostic: false }
t.spawn(process.execPath, [__filename, 'buffer'], '', {}, extra)
}
24 changes: 24 additions & 0 deletions test/test/child-text-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-buffer.js buffer
not ok 1 - parent {
not ok 1 - child {
not ok 1 - grandchild {
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
}
1..1
# failed 1 of 1 tests
not ok 1 - ___/.*/~~~child-text-buffer.js buffer ___/# time=[0-9.]+(ms)?/~~~

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

21 changes: 21 additions & 0 deletions test/test/child-text-indentsub-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-indentsub.js indentsub {
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
}
Bail out! # ___/.*/~~~child-text-indentsub.js indentsub

11 changes: 11 additions & 0 deletions test/test/child-text-indentsub-bail.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-indentsub.js indentsub
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
Bail out! # burn
Bail out! # burn

24 changes: 24 additions & 0 deletions test/test/child-text-indentsub-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-indentsub.js indentsub {
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
}

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

25 changes: 25 additions & 0 deletions test/test/child-text-indentsub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if (process.argv[2] === 'indentsub') {
console.log(function () { /*
TAP version 13
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
*/}.toString().split('\n').slice(1, -1).join('\n'))
} else {
var t = require('../..')
var extra = { diagnostic: false }
t.spawn(process.execPath, [__filename, 'indentsub'], '', {}, extra)
}
24 changes: 24 additions & 0 deletions test/test/child-text-indentsub.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-indentsub.js indentsub
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
not ok 1 - ___/.*/~~~child-text-indentsub.js indentsub ___/# time=[0-9.]+(ms)?/~~~

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

21 changes: 21 additions & 0 deletions test/test/child-text-sub-bail-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-sub.js sub {
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
}
Bail out! # ___/.*/~~~child-text-sub.js sub

11 changes: 11 additions & 0 deletions test/test/child-text-sub-bail.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-sub.js sub
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
Bail out! # burn
Bail out! # burn

24 changes: 24 additions & 0 deletions test/test/child-text-sub-buffer.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
not ok 1 - ___/.*/~~~child-text-sub.js sub {
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
}

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

25 changes: 25 additions & 0 deletions test/test/child-text-sub.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if (process.argv[2] === 'sub') {
console.log(function () { /*
TAP version 13
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
*/}.toString().split('\n').slice(1, -1).join('\n'))
} else {
var t = require('../..')
var extra = { diagnostic: false }
t.spawn(process.execPath, [__filename, 'sub'], '', {}, extra)
}
24 changes: 24 additions & 0 deletions test/test/child-text-sub.tap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
TAP version 13
# Subtest: ___/.*/~~~child-text-sub.js sub
# Subtest: parent
# Subtest: child
# Subtest: grandchild
ok 1 - this is fine
not ok 2 - burn
1..2
# failed 1 of 2 tests
not ok 1 - grandchild
1..1
# failed 1 of 1 tests
not ok 1 - child
1..1
# failed 1 of 1 tests
not ok 1 - parent
1..1
# failed 1 of 1 tests
not ok 1 - ___/.*/~~~child-text-sub.js sub ___/# time=[0-9.]+(ms)?/~~~

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

0 comments on commit c40ed06

Please sign in to comment.