Cannot find module 'react-test-renderer/package' from 'ReactSixteenAdapter.js'
Broke in https://github.com/airbnb/enzyme/commit/98154a945390014a9c97e3a4c6d83eac42f3d73f
Changing the import from:
import { version as testRendererVersion } from 'react-test-renderer/package';
to
import { version as testRendererVersion } from 'react-test-renderer';
Solves the issue for me.
No error...
| library | version
| ------------------- | -------
| enzyme | 3.9.0
| react | 16.8.4
| react-dom | 16.8.4
| react-test-renderer | 16.8.4
| adapter (below) |
We had the same problem: https://travis-ci.com/alibaba-fusion/next/builds/104198552#L667
Was about to create the same issue xD
Same issue here
Same for me. It would be great to get a hotfix asap.
Thanks)
Just freeze it to ~1.10.0 for now. No need to write "same here" 100500 times
This shouldn鈥檛 break for anyone - node supports importing json files without an extension.
If it鈥檚 not working, then your environment is broken.
Adding "json" to jest.moduleFileExtensions in our package.json file works around this problem. Still, I consider it a bug in enzyme-adapter-react-16 to require this configuration.
Considering that's the default configuration of node itself, it's a bug in your jest configuration.
@srittau if you remove your fix to your jest config, and change the import in the adapter to have an explicit .json extension, does that fix the issue for you?
@ljharb It does.
I admit that it makes sense for enzyme to expect to be able to include things without extension, according to node's default configuration. I believe the root problem is that jest does not have an option to add to the default list of file extensions in package.json, just to replace it. But I think enzyme can help maintainers by changing the import of the json file (a not too common case) to include the suffix.
We now opted to remove jest.moduleFileExtensions, since all extensions required by us are now contained in jest's default configuration anyway.
Either way, I'll close this issue by explicitly adding the extension, since that seems to be the best compromise.
Most helpful comment
Just freeze it to
~1.10.0for now. No need to write "same here" 100500 times