You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I verified that the issue exists in the latest next-safe-action release
Is there an existing issue for this?
I have searched the existing issues and found nothing that matches
Describe the bug
Importing anything from next-safe-action/hooks causes Vitest tests to crash due to how React is being imported in that file.
I don't fully understand how the module resolution works here so I cannot tell you exactly why this happens, but I do know that making the following change in the hooks.mjs file fixes the problem 👇
Hi @ludwigbacklund, thanks for opening this issue. I switched from React hooks named imports to a namespace import in the new beta version, that you can install with:
npm i next-safe-action@beta
This should fix the problem with Vitest. Please let me know if everything works fine with the new release, if that's the case, I'll publish a new version in the stable channel soon. Thank you!
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
Importing anything from
next-safe-action/hooks
causes Vitest tests to crash due to how React is being imported in that file.I don't fully understand how the module resolution works here so I cannot tell you exactly why this happens, but I do know that making the following change in the
hooks.mjs
file fixes the problem 👇That's a patch I've applied temporarily to fix the issue in my project.
Reproduction steps
Expected behavior
The test should pass without failing due to how React is being imported.
Reproduction example
https://stackblitz.com/edit/vitest-dev-vitest-6lgc1a?file=test%2Fbasic.test.tsx
Operating System
macOS
Library version
6.0.1
Additional context
No response
The text was updated successfully, but these errors were encountered: