Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Support React Native 0.63.x #136

Merged
merged 5 commits into from
Jul 24, 2020

Conversation

daveols
Copy link
Contributor

@daveols daveols commented Jul 14, 2020

What:

  • Support new Pressable component
  • Remove deprecated accessibilityStates and support accessibilityState.disabled

Fixed issues:

#132 - mock LogBox in the Jest preset
#126 - remove deprecated native mocks and add some new ones similar to how it's done in React Native core
#113 - fixed by adding the component display name to TouchableOpacity and TouchableHighlight mocks via Jest preset

I've also upgraded react-navigation example tests to reference version v4 and all tests to use the latest React and React Native.

Why:

Green tests make me happy.

How:

  • Refactor mockComponent to take instanceMethods and displayName
  • Add some new mocks to the jest preset
  • More testing, fixed some existing tests
  • Other stuff; see code

Checklist:

The documentation will need to be updated to indicate support for Pressable.

This might require a major version bump. I haven't had time to check backwards compatibility outside of React Native 0.62.2.

EDIT
Confirmed compatibility issues with React Native versions <0.62.0 due to the LogBox mock:

 Cannot find module 'react-native/Libraries/LogBox/LogBox' from 'mock-modules.js'

Removing the mock makes these changes backwards compatible (at least in the project that I tested it in, 100+ tests, [email protected]). Unless there's a better way to handle LogBox or to somehow conditionally mock it with Jest, we should bump the major version with these changes.

@codecov
Copy link

codecov bot commented Jul 14, 2020

Codecov Report

Merging #136 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #136   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           20        20           
  Lines          268       268           
  Branches        67        67           
=========================================
  Hits           268       268           
Impacted Files Coverage Δ
src/lib/events.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6de7d48...82ac4a6. Read the comment docs.

@vanGalilea
Copy link

Good work, all fixes we've been waiting for

@drews256
Copy link

@bcarroll22 what needs to be done to move this forward? Anything I can help push along @daveols or @bcarroll22?

@daveols
Copy link
Contributor Author

daveols commented Jul 16, 2020

@drews256 I don't have any write access. We'll need @bcarroll22 to approve, merge, and cut a new release. In the meantime you can reference my fork in your dependencies in which I have compiled the distribution:

"@testing-library/react-native": "github:daveols/native-testing-library#support-react-native-63-dist"

I can't guarantee this will be up forever so make sure you update to the latest release once it's out.

@drews256
Copy link

drews256 commented Jul 16, 2020 via email

@daveols
Copy link
Contributor Author

daveols commented Jul 16, 2020

Ah, gotcha. Nothing from this end @drews256, I think it's good to go.

@julien9999
Copy link

please merge

@daveols
Copy link
Contributor Author

daveols commented Jul 23, 2020

Apparently this repo is to be deprecated, see: callstack/react-native-testing-library#442

@kentcdodds @nickmccurdy in the meantime it would be great to get these fixes out for those who are still dependent on this project and aren't currently in a position to migrate.

@drews256
Copy link

Ahhhh. 👎 Can we confirm @kentcdodds and @nickmccurdy and then please throw a big fat deprecated note on the readme if that is actually the case.

React Native is already hard enough to keep up to date.

@kentcdodds kentcdodds merged commit ad41bb6 into testing-library:master Jul 24, 2020
@bcarroll22
Copy link
Collaborator

🎉 This PR is included in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kentcdodds
Copy link
Member

@all-contributors please add @daveols for code, tests, and docs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @daveols! 🎉

@nickserv
Copy link
Member

nickserv commented Jul 25, 2020

@drews256 If you use fix #n or fixes #n in a commit (replacing n with an issue number in this repository), it will be closed when merged and the bot will automatically mention the release that fixes it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants