Skip to content

🚀 Feature: Support running with node --frozen-intrinsics #5252

Open
@kevinoid

Description

Feature Request Checklist

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    area: node.jscommand-line-or-Node.js-specificstatus: accepting prsMocha can use your help with this one!type: buga defect, confirmed by a maintainertype: featureenhancement proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions