Support ESM
See original GitHub issue🚀 Feature Proposal
Jest is working on supporting ESM https://github.com/facebook/jest/issues/9430 . We should consider lift up the hardcoded target: commonjs
at some points.
Related discussion about detecting whether a file is esm
or commonjs
can be found here https://github.com/facebook/jest/issues/9860
Related issue: #1174
Motivation
Let ts-jest
users as well as jest
users take part in the ESM support development and testing.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:23
- Comments:26 (1 by maintainers)
Top Results From Across the Web
What does it take to support Node.js ESM?
I have worked on all The Guild's libraries and graphql-js to support ESM. Here is how you can do it too.
Read more >Getting Started with (and Surviving) Node.js ESM
The Node.js ecosystem is shifting towards ESM. We examine what lies in store for application and library authors, learn some of challenges ...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Node.js fully supports ECMAScript modules as they are currently specified and ... Caveat: The ESM load hook and namespaced exports from CommonJS modules...
Read more >"ESM" | Can I use... Support tables for HTML5, CSS3, etc
"Can I use" provides up-to-date browser support tables for support of front-end web technologies on desktop and mobile web browsers.
Read more >supports-esm
Detect at runtime if Node.js supports ECMAScript modules. ... Start using supports-esm in your project by running `npm i supports-esm`.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@gadicc you simply import the TS files as usual, omitting the file extension.
This doesn’t make sense to me.
In an ESM project, imports will end with .js. Even when I omit the file extension in my test files, the code under test will import other modules, using
.js
files extensions. In other words:For what it’s worth, @gadicc workaround seems to work for me.