-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
feat(runtime): add support for async code transformation #11191
Conversation
Deploy preview for jestjs ready! Built without sensitive environment variables with commit 1495e07 |
Deploy preview for jestjs ready! Built without sensitive environment variables with commit 23e5f42 |
Deploy preview for jestjs ready! Built without sensitive environment variables with commit 507c635 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth to add a test for async .mjs transform as well?
Codecov Report
@@ Coverage Diff @@
## master #11191 +/- ##
==========================================
- Coverage 64.31% 64.27% -0.05%
==========================================
Files 307 307
Lines 13444 13458 +14
Branches 3281 3285 +4
==========================================
+ Hits 8647 8650 +3
- Misses 4090 4101 +11
Partials 707 707
Continue to review full report at Codecov.
|
@thymikee this is ESM already as we cannot support async transformation for CJS, although via Or am I misunderstanding your question? 😅 Did you mean the transformer should be ESM? |
I meant the file to be |
Ah! I added a test for that together with the feature in #11163. This PR is that the transformation can be async, not transformers. Should rename something... |
Perfect, thanks! I see these are separate responsibilities, could have checked it before asking :) |
No problem 👍 |
@@ -65,7 +65,7 @@ export interface TransformOptions<OptionType = unknown> | |||
|
|||
export interface SyncTransformer<OptionType = unknown> { | |||
canInstrument?: boolean; | |||
createTransformer?: (options?: OptionType) => SyncTransformer; | |||
createTransformer?: (options?: OptionType) => SyncTransformer<OptionType>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of the type changes here should have been in #9889, but I didn't test writing a transformer before merging it, just calling it from runtime
. So snuck it in here 😀
Hmm, I observed something odd. After adopting An example is
|
Please open up a separate issue. Note that we've never really supported using classes, so I don't think we've ever officially supported any form of |
oh nvm, i think something funky with my |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #9504
Test plan
e2e test added