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

Update React and React Native dependencies #61

Merged
merged 6 commits into from
Oct 10, 2019
Merged

Update React and React Native dependencies #61

merged 6 commits into from
Oct 10, 2019

Conversation

SophieAu
Copy link
Contributor

@SophieAu SophieAu commented Sep 26, 2019

What:

Updated the React and React Native dependencies in the package.json

Why:

This allows us to use async act which is new in react-test-renderer 16.9.0

How:

-/-

Checklist:

  • Documentation added to the
    docs site
  • Typescript definitions updated
  • Tests
  • Ready to be merged

I'm not 100% sure about the way I'm differentiating between async and sync act calls. My first thought was simply exposing two different functions: render and asyncRender and fireEvent and asyncFireEvent`. I'm just wondering if there are more elegant ways to handle this....

Tests are still missing since they're dependent on what the actual implementation is going to be. Same with updates to the docs

@codecov
Copy link

codecov bot commented Sep 26, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@55c9716). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             master    #61   +/-   ##
=======================================
  Coverage          ?   100%           
=======================================
  Files             ?     20           
  Lines             ?    266           
  Branches          ?     67           
=======================================
  Hits              ?    266           
  Misses            ?      0           
  Partials          ?      0

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 55c9716...a473853. Read the comment docs.

@bcarroll22
Copy link
Collaborator

Hmm all of the stuff for async act (which was written by Sunil from the React team) was ported over from React Testing Library, so the async render function shouldn't be necessary 🤔The only thing we were waiting for was a version of React Native that supported React 16.9. Just bumping the version of React Native should resolve these warnings.

I'd rather not take any sort of approach like this in any case, because that would knock our API out of parity with the rest of Testing Library, which is something we won't want to do. Can we try just bumping the version of React and running the tests to verify everything still works and the async act warnings go away?

@bcarroll22
Copy link
Collaborator

Actually, @threepointone if you have a chance can you weigh in on whether or not we'll need to do something like this if we've already implemented the same logic as you wrote for React Testing Library?

@jeffreyffs
Copy link
Contributor

I've been using react-native 0.61 in my project and using async act seems to work fine with the current release of this library.

Since react and react-native are * in peerDependencies it should take the version of your project. The devDependencies should only affect the tests being run for this project.

Unless I've horribly misunderstood something 😃

Just updating the dev dependencies to the latest (0.61.1 and 16.9.0 for react and react-test-renderer) silences all the warnings for me.

Sophie Au added 2 commits September 30, 2019 11:00
@SophieAu
Copy link
Contributor Author

I've just reverted all the non-update commits so the only changes left are the library updates 👍

@jeffreyffs
Copy link
Contributor

Upon further review, we might actually need the typing updates. (at least the updates to act).

We should be able to do something similar to @testing-library/react to make it backwards compatible:

import { act as reactAct } from 'react-test-renderer;

export const act: typeof reactAct extends undefined ? (callback: () => void) => void : typeof reactAct;

@bcarroll22
Copy link
Collaborator

@jeffreyffs let's do that in a follow up. I want to go ahead and get this one in.

@allcontributors please add @SophieAu for code. Thanks for your help!

@allcontributors
Copy link
Contributor

@bcarroll22

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

@bcarroll22 bcarroll22 merged commit 550ea42 into testing-library:master Oct 10, 2019
@bcarroll22
Copy link
Collaborator

🎉 This PR is included in version 4.0.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

3 participants