-
Notifications
You must be signed in to change notification settings - Fork 11
Use @testing-library/react-native #277
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
Conversation
cf86f99
to
8cc1718
Compare
8cc1718
to
c029d80
Compare
package.json
Outdated
"react-native-gesture-handler": "^2.15.0", | ||
"react-native-gradle-plugin": "^0.71.19", | ||
"react-test-renderer": "18.3.1", | ||
"react-test-renderer": "18.2.0", |
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.
as @testing-library/react-native
is a replacement for react-test-renderer - can we remove this dependency?
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.
@testing-library/react-native
is built on top of react-test-renderer
so it's still required as a peer dependency → https://github.com/callstack/react-native-testing-library/blob/main/package.json#L59
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.
ah my bad I always end up on the wrong docs page for @testing-library/react-native
- https://testing-library.com/docs/react-native-testing-library/intro <- doesn't mention adding react-test-renderer
- https://callstack.github.io/react-native-testing-library/docs/start/quick-start <- calls out adding react-test-renderer dep
Useful to know - its marked as deprecated from react-native 77 / React19
Once we get to 77 and as of v14 a replacement is in an open PR here: callstack/react-native-testing-library#1705
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.
Interesting, looks like they're replacing it with a universal-test-renderer
package
2ca9d57
to
c23c7bf
Compare
c23c7bf
to
04ce4c4
Compare
04ce4c4
to
4d360b7
Compare
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.
Approving as its a stylistic point - but one benefit of moving to react testing lib is we can use screen
queries instead of the destructuring from render https://github.com/testing-library/dom-testing-library/releases/tag/v6.11.0
reduces the amount of changes needed to maintain / experiment with queries
What changes are you making?
Adds
@testing-library/react-native
and updates the context tests.PR Checklist
Important
Releasing a new version of the kit?
package.json
file.Tip
See the Contributing documentation for instructions on how to publish a new version of the library.