You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a new project using Jest 25.5.2 and Node 12.16.0, using a Jest config file that is an ES module results in an error: TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.
Whether it has .mjs extension or nearest package.json has type: "module", the config file should be loaded identically as an ES module, and there should not be errors.
Because of the above expectation, jest --init command should detect the type: "module" and create the config with export default rather than module.exports = .
Looked now - this is a bug in Node. If you remove the --experimental-vm-modules flag, this is the error: Error: Jest: Your version of Node does not support dynamic import - please enable it or use a .cjs file extension for file /Users/simen/repos/jest-esm-config-issue/jest.config.js
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
馃悰 Bug Report
In a new project using Jest 25.5.2 and Node 12.16.0, using a Jest config file that is an ES module results in an error:
TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.
To Reproduce
https://github.com/aldeed/jest-esm-config-issue#how-to-run-and-see-error
Expected behavior
.mjs
extension or nearestpackage.json
hastype: "module"
, the config file should be loaded identically as an ES module, and there should not be errors.jest --init
command should detect thetype: "module"
and create the config withexport default
rather thanmodule.exports =
.Link to repl or repo (highly encouraged)
https://github.com/aldeed/jest-esm-config-issue
envinfo
The text was updated successfully, but these errors were encountered: