Skip to content

armgit / mocha

Public Imported from GitHub
0

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

fix: catch exceptions setting Error.stackTraceLimit (#5254)

Kevin Locke259f8f8ba570
diff --git a/lib/cli/cli.js b/lib/cli/cli.js
index b1b53540..5a4c6b8d 100755
--- a/lib/cli/cli.js
+++ b/lib/cli/cli.js
@@ -42,7 +42,11 @@ exports.main = (argv = process.argv.slice(2), mochaArgs) => {
module.paths.push(cwd(), path.resolve('node_modules'));
}
- Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?
+ try {
+ Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?
+ } catch (err) {
+ debug('unable to set Error.stackTraceLimit = Infinity', err);
+ }
var args = mochaArgs || loadOptions(argv);