Skip to content

Commit

Permalink
chore: add failing test for #794
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Coe committed Feb 26, 2017
1 parent 21b1e35 commit f3f9550
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/command.js
Expand Up @@ -1100,6 +1100,20 @@ describe('Command', function () {
})
.argv
})

// addresses https://github.com/yargs/yargs/issues/794
it('should bubble errors thrown by coerce function inside commands', function (done) {
yargs
.command('foo', 'the foo command', (yargs) => {
yargs.coerce('x', function (arg) {
throw Error('yikes an error')
})
})
.parse('foo -x 99', function (err) {
err.message.should.match(/yikes an error/)
return done()
})
})
})

describe('defaults', function () {
Expand Down

0 comments on commit f3f9550

Please sign in to comment.