Skip to content
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 ourterms of serviceand privacy statement.We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk): resolve some React 19+ issues in our testing tools #30742

Merged
merged 15 commits into from
Aug 7, 2024

Conversation

byCedric
Copy link
Member

@byCedric byCedric commented Jul 31, 2024

Why

There are a couple:

1. React 19 deprecatesreact-test-renderer

Just the deprecation warning alone causes a few tests to fail. Unfortunately, there is no replacement yet for React Native, meaning even if we did switch to@testing-library/react-native,we'd still usereact-test-renderer.

Luckily for us, there is a temporary workaround, which I've added tojest-expofor now. Read more:https://discord.com/channels/514829729862516747/514832743654228009/1266527040480477274

2.@testing-library/react-hooksseems to be silently deprecated.

There are no updates for React 18, or 19. For React 18, they mention to swap to@testing-library/reactitself, and use therenderHookfunction the original library. That's why I pulled out@testing-library/react-hooksfrom our dependencies.

3. Due to RTR being deprecated, we need to move over to@testing-library/react-native.

Unfortunately, we'd have to wait for proper React 19 support inhttps://github.com/callstack/react-native-testing-library.Right now, it seems thatreact-test-rendererreturnsnullfor a lot of renders, which also seems to indicate there are issues in the current canary version we are using.

How

Unfortunately, this won't fix the current test failures fully. But it does get us on a better path towards being green again (withreact-test-renderer@19)

Test Plan

See CI

Checklist

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jul 31, 2024
@expo-bot
Copy link
Collaborator

expo-bot commented Jul 31, 2024

The Pull Request introduced fingerprint changes against the base commit:1df5f45

Fingerprint diff
[
{
"op":"changed",
"source":{
"type":"file",
"filePath":"../../packages/expo-font/package.json",
"reasons":[
"expoConfigPlugins"
],
"hash":"c982e5637332d396704c8353aac0431b8db4138f"
}
},
{
"op":"changed",
"source":{
"type":"dir",
"filePath":"../../packages/expo-modules-core",
"reasons":[
"expoAutolinkingIos",
"expoAutolinkingAndroid"
],
"hash":"8df1f4081d727ca64a6bab64f3d86bff89800f2c"
}
}
]

Generated byPR labeler🤖

// The renderer is deprecated, but there is no replacement for React Native yet.
// Setting this global property disables the deprecation warning, and changes RTR to legacy mode.
// See: https://discord.com/channels/514829729862516747/514832743654228009/1266527040480477274
globalThis.IS_REACT_NATIVE_TEST_ENVIRONMENT = true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We could also define this in theexpo-module-scriptspreset, if we don't want to ship this temporary workaround to users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Edit: I'll pull it out ofjest-expoand intoexpo-module-scripts,we need a user-facing solution eventually and this is just a temporary workaround.

Copy link
Contributor

@Kudo Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

looks good to me for expo-sqlite changes.

@wschurman wschurman removed their request for review July 31, 2024 18:10
Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Looks good from the docs app side, thanks! 👍

@byCedric byCedric changed the title fix(sdk): resolve React 19+ issues in our testing tools fix(sdk): resolve some React 19+ issues in our testing tools Aug 4, 2024
@byCedric byCedric force-pushed the @bycedric/sdk/fix-react-testing-tools branch 4 times, most recently from 43f0c75 to d20b33d Compare August 6, 2024 14:53
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Aug 6, 2024
@byCedric byCedric force-pushed the @bycedric/sdk/fix-react-testing-tools branch from 3ee29c4 to 969e7da Compare August 7, 2024 09:17
@expo-bot

This comment was marked as off-topic.

@expo-bot expo-bot added bot: suggestions ExpoBot has some suggestions and removed bot: passed checks ExpoBot has nothing to complain about labels Aug 7, 2024
@byCedric byCedric merged commit01cf3f1 into main Aug 7, 2024
38 of 39 checks passed
@byCedric byCedric deleted the @bycedric/sdk/fix-react-testing-tools branch August 7, 2024 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants