首页 > 解决方案 > 既找不到样式组件的秘密内部结构

问题描述

我目前正在尝试更新到 Styled Components 5.0.0,但我遇到了一些问题,我的 JEST 测试停止工作。我已经降级到 4.2.1,但仍然更新了 babel@preset-react、preset-env、core 和其他一些包。当我尝试运行 npm test 时出现此错误:

“找不到样式组件的秘密内部”,它指向import 'jest-styled-components';Jest 样式组件也更新到 7.0.0

标签: reactjstestingjestjsstyled-components

解决方案


https://github.com/styled-components/jest-styled-components/issues/301#issuecomment-893170436

改成 yarn add jest-styled-components@6.3.4 解决问题。


推荐阅读