Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KevinEonix opened this issue May 13, 2024 · 2 comments
Open

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

KevinEonix opened this issue May 13, 2024 · 2 comments
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member

Comments

@KevinEonix
Copy link

Reproduction example

https://github.com/KevinEonix/DevExpressVitestError

Prerequisites

  • Trigger the test for the FormForTest

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:

  • "@testing-library/jest-dom": "^6.4.5",
  • "@testing-library/react": "^15.0.7",
  • "@testing-library/user-event": "^14.5.2",

JS framework:

Test environment:

  • "@vitejs/plugin-react": "^4.2.1",
  • "@vitest/coverage-istanbul": "^1.6.0",
  • "vite": "^5.2.11",
  • "vitest": "^1.6.0"

DOM implementation: [email protected]

Additional context

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

@KevinEonix KevinEonix added bug Something isn't working needs assessment This needs to be looked at by a team member labels May 13, 2024
@ph-fritsche
Copy link
Member

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs assessment This needs to be looked at by a team member
Projects
None yet
Development

No branches or pull requests

2 participants