From 25bda255192831971134122319729a0feb15b5e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A5le=20Tomten?= Date: Mon, 22 Jan 2024 14:33:11 +0100 Subject: [PATCH] Update lib/cli/run.js Co-authored-by: Pelle Wessman --- lib/cli/run.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cli/run.js b/lib/cli/run.js index 1cb4ecea5a..1203e992fd 100644 --- a/lib/cli/run.js +++ b/lib/cli/run.js @@ -369,7 +369,12 @@ exports.handler = async function (argv) { try { await runMocha(mocha, argv); } catch (err) { - console.error('\n' + (err.stack || `Error: ${err && err.message}`), err); + if (!err) { + console.error('\n Undefined error:`, err); + } else { + console.error('\n' + (err.stack || `Error: ${err.message}`), err); + } + process.exit(1); } };