You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
问题描述:Enzyme 的 mount 与 render 无法引入作为测试的 HomePage 组件。 报错内容:Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
尝试将 HomePage (./src/pages/index/index.jsx) 中 Taro 的 组件替换为 ,可以成功执行测试,只是警告 The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.。
相关平台
微信小程序
复现仓库
https://github.com/P233/jest-in-taro
小程序基础库: 最新版本
使用框架: React
复现步骤
问题描述:Enzyme 的 mount 与 render 无法引入作为测试的 HomePage 组件。 报错内容:Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
尝试将 HomePage (./src/pages/index/index.jsx) 中 Taro 的 组件替换为 ,可以成功执行测试,只是警告 The tag is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.。
期望结果
能够使用 Jest 完成 Taro 组件的 UI 测试
实际结果
报错,无法执行
环境信息
The text was updated successfully, but these errors were encountered: