Jest: warning shows about multiple jotai instances when used in tests with requireActual #2460
-
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? |
Beta Was this translation helpful? Give feedback.
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 |
Beta Was this translation helpful? Give feedback.
#2462 is open.
https://ci.codesandbox.io/status/pmndrs/jotai/pr/2462
Can you try it please? Find "Local Install Instructions" ☝️