Jest: warning shows about multiple jotai instances when used in tests with requireActual #2460
Answered
by
dai-shi
scamden
asked this question in
Bug report
|
This warning is firing when I used requireActual on a module that imports jotai. From debugging it seems straightforwardly that jest first imports the module which imports jotai in order to mock it. Then when the mock calls requireActual on that module it reexecutes the module and it's dependencies causing this warning to fire. Not sure what the fix is, maybe we could NODE_ENV for 'test' as well? |
Answered by
dai-shi
Mar 21, 2024
Replies: 1 comment 5 replies
|
Even if it's the test env, the warning is correct. There are two stores in the memory, and it may cause unexpected behaviors. If you are sure that you don't use old stores, you can ignore the warning with mocking console.log. Or, maybe you could mock |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#2462 is open.
https://ci.codesandbox.io/status/pmndrs/jotai/pr/2462
Can you try it please? Find "Local Install Instructions" ☝️