Skip to content

Commit

Permalink
don't actually throw in Stdin.throw
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jan 26, 2017
1 parent 9bb81dc commit 7116d2a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion lib/stdin.js
Expand Up @@ -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()
}
8 changes: 4 additions & 4 deletions test/test/stdin--bail--buffer.tap
Expand Up @@ -26,7 +26,7 @@ ok 1 - fake stdin {
# after
not ok 2 - /dev/stdin
---
{"at":{"column":17,"file":"test/test/stdin.js","function":"Object.<anonymous>","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.<anonymous>","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
Expand All @@ -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

6 changes: 3 additions & 3 deletions test/test/stdin--bail.tap
Expand Up @@ -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

13 changes: 4 additions & 9 deletions test/test/stdin--buffer.tap
Expand Up @@ -26,7 +26,7 @@ ok 1 - fake stdin {
# after
not ok 2 - /dev/stdin
---
{"at":{"column":17,"file":"test/test/stdin.js","function":"Object.<anonymous>","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.<anonymous>","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
Expand All @@ -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

13 changes: 4 additions & 9 deletions test/test/stdin.tap
Expand Up @@ -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.<anonymous>","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.<anonymous>","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

0 comments on commit 7116d2a

Please sign in to comment.