New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature]: Support tc39 "import attributes" #15000
Comments
How are they "not supported"? What breaks? #14345 seems to suggest that the user is already able to use them since tests go through babel. Does this work? Are you using the native ESM support?
|
My project is a TypeScript ESM project:
|
Thanks for the details. What's the exact error you're seeing? Since Jest sees transpiled code, my guess is that the transpiler is misconfigured |
@fregante: The import with the "import attribute" is in an untested file.
|
Yep, that's a babel error, not a Jest/Node one. Just follow the instructions it provides. |
I'm not using As stated by jest in the information written to the terminal along with the error message (see complete content below):
I don't use babel, and don't have any babel configuration file; and I think I should not have to add one just to make jest work with import attributes. It looks like things would have worked if the Proposal: The Additional info: I have now written a test for a module that uses "import attributes". This is the complete informational content written to the terminal when the test fails (I did not include everything in my previous post).
|
I have the same problem. Jest works perfectly with import assert. However, with coverage, the error occurs. I'm using ts-jest. NODE_OPTIONS=--experimental-vm-modules jest --coverage SyntaxError: /swagger.ts: Support for the experimental syntax 'importAttributes' isn't currently enabled (1:47):
Even using ts-jest, I see that the use of babel is fixed in the source. |
🚀 Feature Proposal
I've seen from previous issues that Jest support for import assertions was already added when the proposal was at tc39 stage 3, but that this was reverted/removed again in Feb 2023 as the proposal had been demoted back to stage 2.
Right after this, in March 2023 (more than 1 year back); the proposal went back to stage 3 with a few design changes (keyword
assert
changed towith
), and the of the name of the proposed feature has changed from "import assertions" to "import attributes".Old proposal
New proposal
Import attributes
are now supported in:Our developer team could have written future-proof ECMAScript code, utilizing this upcoming feature - we currently only need it to work with TypeScript and WebPack; but unfortunately it breaks the Jest tests.
When will you add support for import attributes?
Jest is currently our only obstacle...
Motivation
Jest should support the complete ECMAScript module import specs
Example
No response
Pitch
Jest should support the complete ECMAScript module import specs
The text was updated successfully, but these errors were encountered: