I'm using version 6.6.0. The code below intentionally triggers an error:
var argv = require('yargs')
.check((argv, opts) => { throw(new Error("Error!")); return false; })
.argv;
console.log("Hello world!");
... but if I add a .command directive, it does not:
var argv = require('yargs')
.command("foo")
.check((argv, opts) => { throw(new Error("Error!")); return false; })
.argv;
console.log("Hello world!");
$ node test.js foo
Hello world!
$
Oddly enough, if I don't provide the specified command, then .check works again:
$ node test.js bar
Commands:
foo
Error!
$