-
-
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(@jest/transform)!: require process()
and processAsync()
methods to always return structured data
#12638
Conversation
process
and processAsync
to always return structured dataprocess()
and processAsync()
methods to always return structured data
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.
changelog entry? 😀 and https://github.com/facebook/jest/blob/main/docs/CodeTransformation.md needs some updates
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.
yay!
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.
wait, RN is failing. might need to patch it (merge in main
first, I just updated it to v0.68)
can use this patch: facebook/react-native#33576 |
Great. I will try. Docs looked dated. Just could not stop myself. If that’s too much, I can open separate PR. |
@@ -1,8 +1,17 @@ | |||
diff --git a/jest/preprocessor.js b/jest/preprocessor.js |
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.
Yarn placed this file inside .yarn
directory. Perhaps a good idea?
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.
yep, this is where it should be (new in yarn v3 there's a built in --save
)
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.
great stuff!
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
Fixing just another TODO. Transformer methods
process
andprocessAsync
currently are allowed to return a string or an object. As the comment states, perhaps it is fine to require to always return structured data:https://github.com/facebook/jest/blob/72ae96aed9865e7f24e6db89024ca7b04fe62cb9/packages/jest-transform/src/types.ts#L34-L37
Test plan
Code change was minimal, but I had to refactor lots of tests. All should pass.