-
Notifications
You must be signed in to change notification settings - Fork 30k
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
vm.compileFunction
is missing importModuleDynamically
#31860
Comments
@devsnek hey 👋 Starting to land ESM support in Jest now, and was looking into supporting (As an aside, Jest 25.4 includes primitive support for ESM - I'm really digging the APIs! Thanks for all your hard work on this.) |
Ah thank you! |
Fixes: #31860 PR-URL: #32985 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Fixes: #31860 PR-URL: #32985 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Fixes: #31860 PR-URL: #32985 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Fixes: #31860 PR-URL: #32985 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Reopening as this was reverted due to #33166. |
…tion"" This reverts commit 2d5d773. See: nodejs#32985 See: nodejs#33364 See: nodejs#33166 Fixes: nodejs#31860
…tion"" This reverts commit 2d5d773. See: nodejs#32985 See: nodejs#33364 See: nodejs#33166 Fixes: nodejs#31860
…tion"" This reverts commit 2d5d773. See: nodejs#32985 See: nodejs#33364 See: nodejs#33166 Fixes: nodejs#31860
This reverts commit 2d5d773. See: #32985 See: #33364 See: #33166 Fixes: #31860 PR-URL: #35431 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]>
Is your feature request related to a problem? Please describe.
I'm currently working on implementing support for native ES Modules in Jest. While both
vm.SourceTextModule
andvm.Script
allows us to define animportModuleDynamically
option, this is missing fromvm.compileFunction
. The option is also present inrunInContext
andrunInThisContext
.(I'm aware that
vm
's ESM APIs are experimental - I'm just playing with the APIs to see if they fit with Jest's use cases for them. It's currently looking really good! 🙂)Describe the solution you'd like
The option should be added to
compileFunction
as well, to have parity with the othervm
functions/constructs.Describe alternatives you've considered
Not using
compileFunction
and sticking tovm.Script
for CommonJS. I'd really like to avoid that as we just migrated tocompileFunction
which made V8 code coverage mapping from source maps way easier than the old manual module wrapper we use invm.Script
s. Also, it's a bit cleaner on our side when we can avoid manually creating the module wrapper.The text was updated successfully, but these errors were encountered: