Import default "produce" breaks jest tests
joaolpgomes87 opened this issue · 6 comments
When running unit tests using jest it breaks the build.
This is related with the way that produce is imported.
You are importing produce as:
import produce, { enablePatches, applyPatches } from 'immer';
When I believe it should be
import { produce, enablePatches, applyPatches } from 'immer';
The following conversation describes in more detail the issue:
immerjs/immer#992
Hi there, thanks for reporting the issue and proposing a fix. Would you be able to setup a reproduction?
You could reproduce it with the following repo.
https://github.com/MattJRG/ngrx_wieder_test_repo
You should be able to reproduce it when running npx jest
if you the change the way that you import produce from your library, you can see the test passing without any issues.
Thanks for taking a look at this
Sorry to bother you with this again. Did you have time to have a quick look to the repo?
I get the same issue when running tests in your repo. I'll try patching it like you're proposing.
Please try v10.0.2
Perfect. Thanks a lot