Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

fix: harden error handling in `lib/cli/run.js` (#5074)

Ståle Tomten97dcbb282251
diff --git a/lib/cli/run.js b/lib/cli/run.js
index fbbe510e..66c8cbbb 100644
--- a/lib/cli/run.js
+++ b/lib/cli/run.js
@@ -369,7 +369,7 @@ exports.handler = async function (argv) {
try {
await runMocha(mocha, argv);
} catch (err) {
- console.error('\n' + (err.stack || `Error: ${err.message || err}`));
+ console.error('\n Exception during run:', err);
process.exit(1);
}
};
diff --git a/test/integration/reporters.spec.js b/test/integration/reporters.spec.js
index 08fa7f85..9285dfe8 100644
--- a/test/integration/reporters.spec.js
+++ b/test/integration/reporters.spec.js
@@ -211,7 +211,7 @@ describe('reporters', function () {
return;
}
- var pattern = `^Error: invalid or unsupported TAP version: "${invalidTapVersion}"`;
+ var pattern = `Error: invalid or unsupported TAP version: "${invalidTapVersion}"`;
expect(res, 'to satisfy', {
code: 1,
output: new RegExp(pattern, 'm')