首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >React-GA + Redux v7与jest不兼容问题

React-GA + Redux v7与jest不兼容问题
EN

Stack Overflow用户
提问于 2019-04-23 16:34:49
回答 1查看 211关注 0票数 0

我使用的是react-ga v2.5.7,为此我更新了react-redux v7.0.2,我使用的是jest v24.7.1

我在testMode中设置了react-ga,但它在我的jest.setup.js中被模拟了。但是每次我运行我的测试时,我总是遇到同样的问题,大多数测试都因为一些奇怪的原因而失败:

代码语言:javascript
复制
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-gareact-redux的更新,因为有人遇到类似的问题吗?你是怎么解决的?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-04-30 15:38:15

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

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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55807239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档