☕️ Classic, reliable, trusted test framework for Node.js and the browser
fix: print helpful message when internal CLI error happens (#5344)
Rob Wu1e118367dbb2
diff --git a/lib/cli/cli.js b/lib/cli/cli.jsindex 81475a42..bc702fb1 100755--- a/lib/cli/cli.js+++ b/lib/cli/cli.js@@ -66,6 +66,11 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {debug("caught error sometime before command handler: %O", err);yargs.showHelp();console.error(`\n${symbols.error} ${pc.red("ERROR:")} ${msg}`);+ if (!msg) {+ // Log raw error and stack when an unexpected error is encountered, to+ // make debugging easier (instead of an inactionable "ERROR: null").+ console.error(err);+ }process.exit(1);}).help("help", "Show usage information & exit")