-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
area: node.jscommand-line-or-Node.js-specificcommand-line-or-Node.js-specificstatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainertype: featureenhancement proposalenhancement proposal
Description
Feature Request Checklist
- I have read and agree to Mocha's Code of Conduct and Contributing Guidelines
- I have searched for related issues and issues with the
faqlabel, but none matched my issue. - I want to provide a PR to resolve this
Overview
When node is invoked with the experimental --frozen-intrinsics flag (added in Node.js 11.12 by nodejs/node#25685) it causes mocha to exit due to an uncaught TypeError from attempting to set Error.stackTraceLimit:
/path/to/node_modules/mocha/lib/cli/cli.js:45
Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit?
^
TypeError <Object <Object <[Object: null prototype] {}>>>: Cannot assign to read only property 'stackTraceLimit' of function 'function Error() { [native code] }'
at exports.main (/path/to/node_modules/mocha/lib/cli/cli.js:45:25)
at Object.<anonymous> (/path/to/node_modules/mocha/bin/mocha.js:141:29)
at Module._compile (node:internal/modules/cjs/loader:1469:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
at Module.load (node:internal/modules/cjs/loader:1288:32)
at Module._load (node:internal/modules/cjs/loader:1104:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12)
at node:internal/main/run_main_module:28:49
It would be nice if mocha supported running under --frozen-intrinsics for testing code under this flag.
Suggested Solution
Wrapping
Line 45 in d3b2c38
| Error.stackTraceLimit = Infinity; // configurable via --stack-trace-limit? |
in try-catch appears to be sufficient.
Alternatives
Not supporting running under --frozen-intrinsics? (yet)
Additional Info
No response
Metadata
Metadata
Assignees
Labels
area: node.jscommand-line-or-Node.js-specificcommand-line-or-Node.js-specificstatus: accepting prsMocha can use your help with this one!Mocha can use your help with this one!type: buga defect, confirmed by a maintainera defect, confirmed by a maintainertype: featureenhancement proposalenhancement proposal