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

fix act warning on latest react native version v62 when running multiple tests #120

Closed
sibelius opened this issue Apr 16, 2020 · 2 comments

Comments

@sibelius
Copy link
Contributor

  • react-native or expo: react-native
  • react version: 16.11.0
  • native-testing-library version: 5.0.3
  • jest-preset: @testing-library/react-native
  • react-native version: 0.62.2
  • node version: 12

this would be fixed on React 16.9.0, but it is still showing warnings on 16.11.0, related to this issue #25

this only happen when I have multiple it in the same test file

What you did:

tried to run all it tests of a single test file

What happened:

Warning: An update to MyComponent inside a test was not wrapped in act(...).
      
      When testing, code that causes React state updates should be wrapped into act(...):
      
      act(() => {
        /* fire events that update state */
      });
      /* assert on the output */
      
      This ensures that you're testing the behavior the user would see in the browser. Learn more at https://fb.me/react-wrap-tests-with-act

Reproduction:

the component that is warning is using useMemo and useFormik (formik package)

Problem description:

it only warns when multiple tests is running

Suggested solution:

create a failing test showing the issue and fix it

Can you help us fix this issue by submitting a pull request?

not sure, where should I start?

@mym0404
Copy link

mym0404 commented Apr 29, 2020

I think this is not related to this library itself.
The act warnning is in react testing library.
You can read this kentcdodds article

@thymikee
Copy link
Contributor

FYI, this repository is no longer responsible for this package. See the migration guide to v7.0 and check if it happens there.

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

No branches or pull requests

3 participants