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
After seeing #2831 I tried to set a (simple) astTransformer in pure JS with no luck. Not sure if I'm hitting a bug or I misunderstood something. I made a minimal repo (based in the one from that issue, thanks for the boilerplate):
Hi, I've checked your repo. Your transformer works correctly. However, type checking process in TypeScript doesn't perform on the js output but it runs on original ts, which explains why you still get the error
error TS1343: The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
Note that custom AST transformers only affects how you want your js to be. It doesn't affect on type checking process
🐛 Bug Report
After seeing #2831 I tried to set a (simple) astTransformer in pure JS with no luck. Not sure if I'm hitting a bug or I misunderstood something. I made a minimal repo (based in the one from that issue, thanks for the boilerplate):
https://github.com/acalvo/ts-jest-ast-transformer
Use case:
import.meta.url
which is not supported when runningjest
with that config (errorThe 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', or 'system'.
).'http://localhost/'
instead ofimport.meta.url
, Jest would run correctly, so I want to make that transformation.To Reproduce
Expected behavior
I'd expect the transformation (
import.meta.url
->'http://localhost/'
) to apply, and the test to pass.Instead, the test fails because the unsupported
import.meta.url
is still there.Link to repo (highly encouraged)
https://github.com/acalvo/ts-jest-ast-transformer
Debug log:
envinfo
Thanks!!
The text was updated successfully, but these errors were encountered: