Skip to content

Commit 7116d2a

Browse files
committed
don't actually throw in Stdin.throw
1 parent 9bb81dc commit 7116d2a

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

lib/stdin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ Stdin.prototype.main = function (cb) {
3131
Stdin.prototype.threw = function (er, extra, proxy) {
3232
extra = Base.prototype.threw.call(this, er, extra, proxy)
3333
this.options = extra
34-
this.parser.abort(extra.message, extra)
34+
this.parser.abort(er.message, extra)
3535
this.parser.end()
3636
}

test/test/stdin--bail--buffer.tap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ok 1 - fake stdin {
2626
# after
2727
not ok 2 - /dev/stdin
2828
---
29-
{"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"}
29+
{"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"}
3030
...
3131
{
3232
1..3
@@ -39,9 +39,9 @@ not ok 2 - /dev/stdin
3939
}
4040
ok 3
4141

42-
not ok 4 - test unfinished
42+
not ok 4 - expect to throw this
4343

44-
Bail out! # test unfinished
44+
Bail out! # expect to throw this
4545
}
46-
Bail out! # test unfinished
46+
Bail out! # expect to throw this
4747

test/test/stdin--bail.tap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ ok 1 - fake stdin
3535
}
3636
ok 3
3737

38-
not ok 4 - test unfinished
38+
not ok 4 - expect to throw this
3939

40-
Bail out! # test unfinished
41-
Bail out! # test unfinished
40+
Bail out! # expect to throw this
41+
Bail out! # expect to throw this
4242

test/test/stdin--buffer.tap

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ ok 1 - fake stdin {
2626
# after
2727
not ok 2 - /dev/stdin
2828
---
29-
{"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"}
29+
{"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"}
3030
...
3131
{
3232
1..3
@@ -39,17 +39,12 @@ not ok 2 - /dev/stdin
3939
}
4040
ok 3
4141

42-
not ok 4 - test unfinished
42+
not ok 4 - expect to throw this
4343

4444
# test count(4) != plan(3)
4545
# failed 2 of 4 tests
4646
}
4747

48-
not ok 3 - Cannot read property 'replace' of undefined
49-
---
50-
{"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"}
51-
...
52-
53-
1..3
54-
# failed 2 of 3 tests
48+
1..2
49+
# failed 1 of 2 tests
5550

test/test/stdin.tap

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,15 @@ ok 1 - fake stdin
3535
}
3636
ok 3
3737

38-
not ok 4 - test unfinished
38+
not ok 4 - expect to throw this
3939

4040
# test count(4) != plan(3)
4141
# failed 2 of 4 tests
4242
not ok 2 - /dev/stdin
4343
---
44-
{"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"}
44+
{"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"}
4545
...
4646

47-
not ok 3 - Cannot read property 'replace' of undefined
48-
---
49-
{"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"}
50-
...
51-
52-
1..3
53-
# failed 2 of 3 tests
47+
1..2
48+
# failed 1 of 2 tests
5449

0 commit comments

Comments
 (0)