我使用的是react-ga v2.5.7,为此我更新了react-redux v7.0.2,我使用的是jest v24.7.1
我在testMode中设置了react-ga,但它在我的jest.setup.js中被模拟了。但是每次我运行我的测试时,我总是遇到同样的问题,大多数测试都因为一些奇怪的原因而失败:
Test suite failed to run
Cannot find module '@icons/material/CheckIcon' from 'SwatchesColor.js'
However, Jest was able to find:
'./SwatchesColor.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
However, Jest was able to find:
'./SwatchesGroup.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
However, Jest was able to find:
'components/swatches/Swatches.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
However, Jest was able to find:
'./VisualIdentityColorPicker.js'
'./VisualIdentityColorPicker.spec.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
However, Jest was able to find:
'./VisualIdentityBackgroundSelector.js'
'./VisualIdentityBackgroundSelector.spec.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['js', 'json', 'jsx', 'ts', 'tsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string虽然SwatchesColors是一个完全不相关的模块的依赖。在我看来,有一个不兼容的问题,在我的项目中唯一改变的是添加了react-ga和react-redux的更新,因为有人遇到类似的问题吗?你是怎么解决的?
发布于 2019-04-30 15:38:15
我发现了实际的问题,它似乎与一个未导入的组件有关,该组件导致了测试中的奇怪行为。
一旦我导入了它,问题就消失了。
https://stackoverflow.com/questions/55807239
复制相似问题