Skip to content

Commit 97dcbb2

Browse files
staletvoxpelli
andauthored
fix: harden error handling in lib/cli/run.js (#5074)
* Bugfix: Output stacktrace to support typescript errors. Before this patch the errorhandling would fail with the error: "ERROR: null". Debug showed that the error "caught error sometime before command handler: TypeError: Cannot convert object to primitive value" * Update lib/cli/run.js Co-authored-by: Pelle Wessman <pelle@kodfabrik.se> * Fix minor typo. * Update lib/cli/run.js Do not change the original functionality. Co-authored-by: Pelle Wessman <pelle@kodfabrik.se> * Check that the toString method is available on the error. * Opting for a simplified solution * Fix tests --------- Co-authored-by: Pelle Wessman <pelle@kodfabrik.se>
1 parent 6f3f45e commit 97dcbb2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/cli/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ exports.handler = async function (argv) {
369369
try {
370370
await runMocha(mocha, argv);
371371
} catch (err) {
372-
console.error('\n' + (err.stack || `Error: ${err.message || err}`));
372+
console.error('\n Exception during run:', err);
373373
process.exit(1);
374374
}
375375
};

test/integration/reporters.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ describe('reporters', function () {
211211
return;
212212
}
213213

214-
var pattern = `^Error: invalid or unsupported TAP version: "${invalidTapVersion}"`;
214+
var pattern = `Error: invalid or unsupported TAP version: "${invalidTapVersion}"`;
215215
expect(res, 'to satisfy', {
216216
code: 1,
217217
output: new RegExp(pattern, 'm')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy