Skip to content

Warning: You called act(async () => ...) without await. 2 minute repro on examples/reactnavigation #859

Closed
@princefishthrower

Description

@princefishthrower

Describe the bug

I see the infamous Warning: You called act(async () => ...) without await. after a fresh clone and install checking out the reactnavigation example.

Expected behavior

No warnings. I thought react-native-testing-library is supposed to wrap all async actions in act already? I guess and use await

Steps to Reproduce

  1. Clone this repository: git clone https://github.com/callstack/react-native-testing-library.git
  2. Move into the proper example: cd react-native-testing-library/examples/reactnavigation
  3. Install packages: npm install (You need npm install --legacy-peer-deps if you are using a newer version of Node)
  4. Run tests: npm run test
  5. See warnings in test output:
console.error
      Warning: You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);

Versions

npmPackages:
    @testing-library/react-native: ^7.0.0-rc.0 => 7.2.0 
    react: ^16.13.1 => 16.14.0 
    react-native: ^0.62.2 => 0.62.3 
    react-test-renderer: ^16.13.1 => 16.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions