Convert tests containing render to async#27994
Closed
kassens wants to merge 2 commits intofacebook:mainfrom
Closed
Convert tests containing render to async#27994kassens wants to merge 2 commits intofacebook:mainfrom
kassens wants to merge 2 commits intofacebook:mainfrom
Conversation
This adds `hermes-transform` as a dependency for scripts to allow us to run some codemods updating tests. If this turns out useful, there's obviously more that can be done to the script, but as these internal codemods are pretty one-off, I'm also okay to keep it fairly rough. The included codemod is a starting point to convert tests to `crateRoot`. Due to many different patterns in tests, this does just the following: - convert `it` and `expect` calls that contain `ReactDOM.render` to the async variant, so `await` can be used inside. - convert `ReactDOM.render(el, container)` to `root.render(el)`. Note that this does not create `root` and that needs to be updated manually.
This runs a simple codemod converting all `it` calls to async functions when they contain a `ReactDOM.render` call. There's no real harm in doing it in bulk and the tests will need to be switched anyway when moving to `createRoot`. This should reduce noise and manual changes needed.
Member
lol, you'll need to skip the tests that use
|
Member
|
Also a heads up that I think the codemod isn't carrying over the args to the test function, which could also be a problem for test.each, since that passes the values for each case to the test fn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Convert tests containing render to async
This runs a simple codemod converting all
itcalls to async functions when they contain aReactDOM.rendercall.There's no real harm in doing it in bulk and the tests will need to be switched anyway when moving to
createRoot.This should reduce noise and manual changes needed.
Stack created with Sapling. Best reviewed with ReviewStack.