We're in the process of completely replacing https://github.com/testing-library/native-testing-library with this repo. Which means renaming react-native-testing-library to @testing-library/react-native.
Would anyone be interested in writing a migration guide?
EDIT:
Migration guide: https://callstack.github.io/react-native-testing-library/docs/migration-v7
I could help.
Awesome @balavishnuvj! Let me know if you need any help. So far, in terms of differences between the libs, I'm only aware of the "disabled" property being specially handled by the second library. Is there anything else?
@thymikee I don't understand in and out of the library as of now. Would need your help. Also, this would one of my first open-source contributions.
I am working on migrating a project from @testing-library/react-native to this one now.
The first difference I noticed was that '@testing-library/react-native/cleanup-after-each', in the jest.config.js was no longer required because it happens by default in this library (see docs here).
Second, there is a difference in querying by accessibility labels between the two libraries. @testing-library/react-native uses queryByLabelText (see here), whereas this library uses queryByAccessibilityLabel, or queryByA11yLabel (see here).
Hope this helps!
I'm happy to accept a PR that aliases *ByA11yLabel to *ByLabelText to ease the migration :)
I would be happy to take on this PR, but it would be my first time contributing to the project.
To clarify, we would alias any queries ending in ByLabelText to use ByA11yLabel instead? Should we display some sort of warning that this is temporary to support migration from the other library?
Great! No warning is needed, queryByAccessibilityLabel is already an alias of queryByA11yLabel, so it's a matter of extending that to another value. Should be fairly straight-forward I hope :)
@thymikee Just put a PR up for it now. I think I see what you mean, hopefully this was what you were thinking. 馃槃
Hi all,
Just migrated my real world examples repo, was pretty straightforward here are the diffs:
https://github.com/vanGalilea/react-native-testing/commit/66f8fd3bc08ccb47585ff7d0665da1b5e38f3314
https://github.com/vanGalilea/react-native-testing/commit/364a4b465cd562e650600dd064d8bee1c2775d2a
Summary of all changes in my repo:
[ ] in jest.config.js:
package.json:
Thank you very much @vanGalilea!
v6 of @testing-library/react-native was just published. So when we publish this repo as the main package it will need to be version 7
Awesome @balavishnuvj! Let me know if you need any help. So far, in terms of differences between the libs, I'm only aware of the "disabled" property being specially handled by the second library. Is there anything else?
You mean that the props 'disabled' is not available on TocuhableOpacity as a test instance?
Having that problem while migrating
Hey all, I've added a migration guide PR: https://github.com/callstack/react-native-testing-library/pull/456. Please review, let me know if I missed anything and if there are any readability improvements we can make :)
Anyone have interest in taking over https://github.com/testing-library/jest-native as part of this?
I'm happy to watch jest-native over. Since the migration guide is created. I'm closing this issue. Thanks everyone for your cooperation, it was very helpful!
Most helpful comment
v6 of @testing-library/react-native was just published. So when we publish this repo as the main package it will need to be version 7