我正在使用react-ga
v2.5.7,为此我更新了react-redux
v7.0.2,并且我正在使用jest
v24.7.1
我在react-ga
中设置了testMode
,并且在我的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
,因为有人遇到过类似的问题吗?
您是如何解决的?
答案 0 :(得分:0)
我发现了实际的问题,它似乎与未导入的组件有关,该组件在测试中引起了奇怪的行为。
一旦导入,问题就消失了。