testing-library / user-event

🐕 Simulate user events
https://testing-library.com/user-event
MIT License
2.18k stars 245 forks source link

act warning with vitest when forcing `module resolution` with vitejs #1213

Open KevinEonix opened 4 months ago

KevinEonix commented 4 months ago

Reproduction example

https://github.com/KevinEonix/DevExpressVitestError

Prerequisites

Expected behavior

not returning the warning for act

Actual behavior

It return an act warning when awaiting the call to userEvent

User-event version

14.5.2

Environment

Testing Library framework:

JS framework:

Test environment:

DOM implementation: jsdom@24.0.0

Additional context

Here is the link to the repository https://github.com/KevinEonix/DevExpressVitestError

ph-fritsche commented 3 months ago

This might be a configuration issue. The act warnings are handled by the wrappers brought by @testing-library/react.

Please try to remove unnecessary calls and config entries like https://github.com/KevinEonix/DevExpressVitestError/blob/13404333f4fc9aa8d5935520a9ae4fea98a033e9/src/FormForTest/FormForTest.test.tsx#L6-L8 https://github.com/KevinEonix/DevExpressVitestError/blob/13404333f4fc9aa8d5935520a9ae4fea98a033e9/vite.config.ts#L32

If the problem persists, please try to reduce the reproduction to a minimal example that still displays the issue – preferably without third-party libraries like react-hook-forms.

KevinEonix commented 3 months ago

I tried without the configs and the cleanup call but unfortunately, i have the same issue. See the test-without-rhf branch