From 7116d2af7d15ed2ad9721c03ba158beccc470f73 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 25 Jan 2017 16:51:48 -0800 Subject: [PATCH] don't actually throw in Stdin.throw --- lib/stdin.js | 2 +- test/test/stdin--bail--buffer.tap | 8 ++++---- test/test/stdin--bail.tap | 6 +++--- test/test/stdin--buffer.tap | 13 ++++--------- test/test/stdin.tap | 13 ++++--------- 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/lib/stdin.js b/lib/stdin.js index 9c178d059..e85c77310 100644 --- a/lib/stdin.js +++ b/lib/stdin.js @@ -31,6 +31,6 @@ Stdin.prototype.main = function (cb) { Stdin.prototype.threw = function (er, extra, proxy) { extra = Base.prototype.threw.call(this, er, extra, proxy) this.options = extra - this.parser.abort(extra.message, extra) + this.parser.abort(er.message, extra) this.parser.end() } diff --git a/test/test/stdin--bail--buffer.tap b/test/test/stdin--bail--buffer.tap index 0f91c5cda..904fb2cc0 100644 --- a/test/test/stdin--bail--buffer.tap +++ b/test/test/stdin--bail--buffer.tap @@ -26,7 +26,7 @@ ok 1 - fake stdin { # after not ok 2 - /dev/stdin --- - {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} + {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} ... { 1..3 @@ -39,9 +39,9 @@ not ok 2 - /dev/stdin } ok 3 - not ok 4 - test unfinished + not ok 4 - expect to throw this - Bail out! # test unfinished + Bail out! # expect to throw this } -Bail out! # test unfinished +Bail out! # expect to throw this diff --git a/test/test/stdin--bail.tap b/test/test/stdin--bail.tap index 2b2d20db4..1f3e04130 100644 --- a/test/test/stdin--bail.tap +++ b/test/test/stdin--bail.tap @@ -35,8 +35,8 @@ ok 1 - fake stdin } ok 3 - not ok 4 - test unfinished + not ok 4 - expect to throw this - Bail out! # test unfinished -Bail out! # test unfinished + Bail out! # expect to throw this +Bail out! # expect to throw this diff --git a/test/test/stdin--buffer.tap b/test/test/stdin--buffer.tap index 78cc7246a..2368f1892 100644 --- a/test/test/stdin--buffer.tap +++ b/test/test/stdin--buffer.tap @@ -26,7 +26,7 @@ ok 1 - fake stdin { # after not ok 2 - /dev/stdin --- - {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} + {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} ... { 1..3 @@ -39,17 +39,12 @@ not ok 2 - /dev/stdin } ok 3 - not ok 4 - test unfinished + not ok 4 - expect to throw this # test count(4) != plan(3) # failed 2 of 4 tests } -not ok 3 - Cannot read property 'replace' of undefined - --- - {"at":{"column":20,"file":"___/.*/~~~-parser/index.js","function":"Parser.abort","line":690},"source":"message = message.replace(/[\\n\\r\\s\\t]/g, ' ')\n","test":"TAP","type":"TypeError"} - ... - -1..3 -# failed 2 of 3 tests +1..2 +# failed 1 of 2 tests diff --git a/test/test/stdin.tap b/test/test/stdin.tap index c716a7494..cad420056 100644 --- a/test/test/stdin.tap +++ b/test/test/stdin.tap @@ -35,20 +35,15 @@ ok 1 - fake stdin } ok 3 - not ok 4 - test unfinished + not ok 4 - expect to throw this # test count(4) != plan(3) # failed 2 of 4 tests not ok 2 - /dev/stdin --- - {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"test unfinished","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} + {"at":{"column":17,"file":"test/test/stdin.js","function":"Object.","line":60},"failures":[{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"},{"id":4,"name":"expect to throw this","plan":{"end":3,"start":1},"tapError":"id greater than plan end"}],"source":"p.emit('error', new Error('expect to throw this'))\n","test":"/dev/stdin"} ... -not ok 3 - Cannot read property 'replace' of undefined - --- - {"at":{"column":20,"file":"___/.*/~~~-parser/index.js","function":"Parser.abort","line":690},"source":"message = message.replace(/[\\n\\r\\s\\t]/g, ' ')\n","test":"TAP","type":"TypeError"} - ... - -1..3 -# failed 2 of 3 tests +1..2 +# failed 1 of 2 tests