0

我正在使用react-gav2.5.7,为此我更新了v7.0.2 react-redux,我正在使用jestv24.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,因为有人遇到类似的问题?你是怎么解决的?

4

1 回答 1

1

我发现了实际问题,它似乎与在测试中导致奇怪行为的未导入组件有关。

一旦我导入它,问题就消失了。

于 2019-04-30T07:38:14.850 回答