Skip to content

Move to @testing-library/react-native 🎉 #442

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

Closed
kentcdodds opened this issue Jul 16, 2020 · 15 comments · Fixed by #456
Closed

Move to @testing-library/react-native 🎉 #442

kentcdodds opened this issue Jul 16, 2020 · 15 comments · Fixed by #456

Comments

@kentcdodds
Copy link

kentcdodds commented Jul 16, 2020

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

@balavishnuvj
Copy link

I could help.

@thymikee
Copy link
Member

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?

@balavishnuvj
Copy link

@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.

@ryanjwessel
Copy link
Contributor

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!

@thymikee
Copy link
Member

thymikee commented Jul 17, 2020

I'm happy to accept a PR that aliases *ByA11yLabel to *ByLabelText to ease the migration :)

@ryanjwessel
Copy link
Contributor

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?

@thymikee
Copy link
Member

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 :)

@ryanjwessel
Copy link
Contributor

@thymikee Just put a PR up for it now. I think I see what you mean, hopefully this was what you were thinking. 😄

@vanGalilea
Copy link
Contributor

vanGalilea commented Jul 18, 2020

Hi all,

Just migrated my real world examples repo, was pretty straightforward here are the diffs:

vanGalilea/react-native-testing@66f8fd3

vanGalilea/react-native-testing@364a4b4

Summary of all changes in my repo:

@thymikee
Copy link
Member

Thank you very much @vanGalilea!

@kentcdodds
Copy link
Author

kentcdodds commented Jul 24, 2020

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

@vanGalilea
Copy link
Contributor

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

@thymikee thymikee added this to the 7.x milestone Jul 24, 2020
@thymikee
Copy link
Member

Hey all, I've added a migration guide PR: #456. Please review, let me know if I missed anything and if there are any readability improvements we can make :)

@kentcdodds
Copy link
Author

kentcdodds commented Jul 25, 2020

Anyone have interest in taking over https://github.com/testing-library/jest-native as part of this?

testing-library/jest-native#31

@thymikee
Copy link
Member

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!

@thymikee thymikee changed the title Migration guide? Move to @testing-library/react-native 🎉 Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants