diff --git a/test/test/teardown-timing--bail--buffer.tap b/test/test/teardown-timing--bail--buffer.tap new file mode 100644 index 000000000..5093a79ba --- /dev/null +++ b/test/test/teardown-timing--bail--buffer.tap @@ -0,0 +1,28 @@ +TAP version 13 +############## step1 startup +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step1 teardown +############## step2 startup +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step2 teardown +############## step3 startup +############## step4 startup +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step3 teardown +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step4 teardown +1..4 +___/# time=[0-9.]+(ms)?/~~~ + diff --git a/test/test/teardown-timing--bail.tap b/test/test/teardown-timing--bail.tap new file mode 100644 index 000000000..cc8f5ab5a --- /dev/null +++ b/test/test/teardown-timing--bail.tap @@ -0,0 +1,28 @@ +TAP version 13 +############## step1 startup +# Subtest: step1 + 1..0 +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ + +############## step2 startup +############## step1 teardown +# Subtest: step2 + 1..0 +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 startup +# Subtest: step3 + 1..0 +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 teardown +############## step4 startup +# Subtest: step4 + 1..0 +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ + +############## step4 teardown +############## step2 teardown +1..4 +___/# time=[0-9.]+(ms)?/~~~ + diff --git a/test/test/teardown-timing--buffer.tap b/test/test/teardown-timing--buffer.tap new file mode 100644 index 000000000..5093a79ba --- /dev/null +++ b/test/test/teardown-timing--buffer.tap @@ -0,0 +1,28 @@ +TAP version 13 +############## step1 startup +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step1 teardown +############## step2 startup +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step2 teardown +############## step3 startup +############## step4 startup +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step3 teardown +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step4 teardown +1..4 +___/# time=[0-9.]+(ms)?/~~~ + diff --git a/test/test/teardown-timing-throws--bail--buffer.tap b/test/test/teardown-timing-throws--bail--buffer.tap new file mode 100644 index 000000000..f0d3a8258 --- /dev/null +++ b/test/test/teardown-timing-throws--bail--buffer.tap @@ -0,0 +1,32 @@ +TAP version 13 +############## step1 startup +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step1 teardown +############## step2 startup +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step2 teardown +############## step3 startup +############## step4 startup +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step3 teardown +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step4 teardown +not ok 5 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":7},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +Bail out! # ############## step1 teardown + diff --git a/test/test/teardown-timing-throws--bail.tap b/test/test/teardown-timing-throws--bail.tap new file mode 100644 index 000000000..d148aefcb --- /dev/null +++ b/test/test/teardown-timing-throws--bail.tap @@ -0,0 +1,31 @@ +TAP version 13 +############## step1 startup +# Subtest: step1 + 1..0 +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ + +############## step2 startup +############## step1 teardown +# Subtest: step2 + 1..0 +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 startup +# Subtest: step3 + 1..0 +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 teardown +############## step4 startup +# Subtest: step4 + 1..0 +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ + +############## step4 teardown +not ok 5 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":7},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +Bail out! # ############## step1 teardown + diff --git a/test/test/teardown-timing-throws--buffer.tap b/test/test/teardown-timing-throws--buffer.tap new file mode 100644 index 000000000..067ee05c6 --- /dev/null +++ b/test/test/teardown-timing-throws--buffer.tap @@ -0,0 +1,49 @@ +TAP version 13 +############## step1 startup +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step1 teardown +############## step2 startup +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step2 teardown +############## step3 startup +############## step4 startup +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step3 teardown +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ { + 1..0 +} + +############## step4 teardown +not ok 5 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":7},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +not ok 6 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":16},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +not ok 7 - ############## step3 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":25},"source":"throw new Error('############## step3 teardown')\n","test":"TAP"} + ... + +not ok 8 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":34},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +1..8 +# failed 4 of 8 tests +___/# time=[0-9.]+(ms)?/~~~ + diff --git a/test/test/teardown-timing-throws.js b/test/test/teardown-timing-throws.js new file mode 100644 index 000000000..b3d2b37b5 --- /dev/null +++ b/test/test/teardown-timing-throws.js @@ -0,0 +1,37 @@ +var t = require('../..') + +t.test('step1', function (t) { + console.log('##############', 'step1 startup') + t.tearDown(function () { + console.log('############## step1 teardown') + throw new Error('############## step1 teardown') + }) + setImmediate(t.done) +}) + +t.test('step2', function (t) { + console.log('##############', 'step2 startup') + t.tearDown(function () { + console.log('############## step2 teardown') + throw new Error('############## step1 teardown') + }) + setImmediate(t.done) +}) + +t.test('step3', function (t) { + console.log('##############', 'step3 startup') + t.tearDown(function () { + console.log('############## step3 teardown') + throw new Error('############## step3 teardown') + }) + t.done() +}) + +t.test('step4', function (t) { + console.log('##############', 'step4 startup') + t.tearDown(function () { + console.log('############## step4 teardown') + throw new Error('############## step1 teardown') + }) + t.done() +}) diff --git a/test/test/teardown-timing-throws.tap b/test/test/teardown-timing-throws.tap new file mode 100644 index 000000000..5d8426b5c --- /dev/null +++ b/test/test/teardown-timing-throws.tap @@ -0,0 +1,49 @@ +TAP version 13 +############## step1 startup +# Subtest: step1 + 1..0 +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ + +############## step2 startup +############## step1 teardown +# Subtest: step2 + 1..0 +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 startup +# Subtest: step3 + 1..0 +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 teardown +############## step4 startup +# Subtest: step4 + 1..0 +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ + +############## step4 teardown +not ok 5 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":7},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +not ok 6 - ############## step3 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":25},"source":"throw new Error('############## step3 teardown')\n","test":"TAP"} + ... + +not ok 7 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":34},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +############## step2 teardown +not ok 8 - ############## step1 teardown + --- + {"at":{"column":11,"file":"test/test/teardown-timing-throws.js","line":16},"source":"throw new Error('############## step1 teardown')\n","test":"TAP"} + ... + +1..8 +# failed 4 of 8 tests +___/# time=[0-9.]+(ms)?/~~~ + diff --git a/test/test/teardown-timing.js b/test/test/teardown-timing.js new file mode 100644 index 000000000..fe657937a --- /dev/null +++ b/test/test/teardown-timing.js @@ -0,0 +1,33 @@ +var t = require('../..') + +t.test('step1', function (t) { + console.log('##############', 'step1 startup') + t.tearDown(function () { + console.log('##############', 'step1 teardown') + }) + setImmediate(t.done) +}) + +t.test('step2', function (t) { + console.log('##############', 'step2 startup') + t.tearDown(function () { + console.log('##############', 'step2 teardown') + }) + setImmediate(t.done) +}) + +t.test('step3', function (t) { + console.log('##############', 'step3 startup') + t.tearDown(function () { + console.log('##############', 'step3 teardown') + }) + t.done() +}) + +t.test('step4', function (t) { + console.log('##############', 'step4 startup') + t.tearDown(function () { + console.log('##############', 'step4 teardown') + }) + t.done() +}) diff --git a/test/test/teardown-timing.tap b/test/test/teardown-timing.tap new file mode 100644 index 000000000..cc8f5ab5a --- /dev/null +++ b/test/test/teardown-timing.tap @@ -0,0 +1,28 @@ +TAP version 13 +############## step1 startup +# Subtest: step1 + 1..0 +ok 1 - step1 ___/# time=[0-9.]+(ms)?/~~~ + +############## step2 startup +############## step1 teardown +# Subtest: step2 + 1..0 +ok 2 - step2 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 startup +# Subtest: step3 + 1..0 +ok 3 - step3 ___/# time=[0-9.]+(ms)?/~~~ + +############## step3 teardown +############## step4 startup +# Subtest: step4 + 1..0 +ok 4 - step4 ___/# time=[0-9.]+(ms)?/~~~ + +############## step4 teardown +############## step2 teardown +1..4 +___/# time=[0-9.]+(ms)?/~~~ +