floating-ui / react-popper

🍿⚛Official React library to use Popper, the positioning library
https://popper.js.org/react-popper/
MIT License
2.5k stars 226 forks source link

Warning when running tests. #431

Closed Dito-Orkodashvili closed 2 years ago

Dito-Orkodashvili commented 2 years ago

There is an issue when running tests. It logs this warning:

image

I found the way to hide this warning in the Tooltip component like this:

const setup = async (props = {}) => {
  let result;
  await act(async () => {
    result = await render(<App />);
  });
  return result;
};

But the issue is that I need to fight these warnings in all component tests where I use this Tooltip component. It even gets worse where the multiple Tooltip elements are rendered. It makes the tests log very messy and unusable.

I really love this library and don't want to drop using it because of this issue.

Reproduction demo

https://codesandbox.io/s/jolly-mclaren-srycv?file=/src/App.test.js

Steps to reproduce the problem

Package versions

atomiks commented 2 years ago

View here, applies to Popper as well: https://floating-ui.com/docs/react-dom#testing