账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    在react项目中跑jest的测试报错:Element type is invalid: expected
    30
    0

    react项目在浏览器跑没问题,但是跑jest单元测试报错

    Test suite failed to run

    Invariant Violation: 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.
    
    
      
      at invariant (node_modules/react-dom/cjs/react-dom.development.js:55:15)
      at createFiberFromTypeAndProps (node_modules/react-dom/cjs/react-dom.development.js:10100:11)
      at createFiberFromElement (node_modules/react-dom/cjs/react-dom.development.js:10121:15)
      at reconcileSingleElement (node_modules/react-dom/cjs/react-dom.development.js:12392:23)
      at reconcileChildFibers (node_modules/react-dom/cjs/react-dom.development.js:12449:35)      at reconcileChildren (node_modules/react-dom/cjs/react-dom.development.js:14069:28)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:14723:5)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:15203:16)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:18789:12)
      at workLoop (node_modules/react-dom/cjs/react-dom.development.js:18829:24)
      at renderRoot (node_modules/react-dom/cjs/react-dom.development.js:18912:7)
      at performWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:19809:7)
      at performWork (node_modules/react-dom/cjs/react-dom.development.js:19721:7)
      at performSyncWork (node_modules/react-dom/cjs/react-dom.development.js:19695:3)
      at requestWork (node_modules/react-dom/cjs/react-dom.development.js:19564:5)
      at scheduleWork (node_modules/react-dom/cjs/react-dom.development.js:19373:5)
      at scheduleRootUpdate (node_modules/react-dom/cjs/react-dom.development.js:20041:3)
      at updateContainerAtExpirationTime (node_modules/react-dom/cjs/react-dom.development.js:20069:10)
      at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:20126:10)
      at ReactRoot.Object.<anonymous>.ReactRoot.render (node_modules/react-dom/cjs/react-dom.development.js:20422:3)
      at node_modules/react-dom/cjs/react-dom.development.js:20559:14
      at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:19924:10)
      at legacyRenderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:20555:5)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:20624:12)
      at render (node_modules/dva/lib/index.js:113:12)
      at Object.start (node_modules/dva/lib/index.js:81:7)
      at Object.<anonymous> (src/index.js:189:5)
      at Object.<anonymous> (src/utils/request.js:1727:33)
      at Object.<anonymous> (src/utils/utils.js:2582:35)
      at Object.<anonymous> (src/utils/tests/utils.test.js:9:14)
    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    更多回答
    扫一扫访问手机版

    回答动态

    师傅被妖怪抓走了:发布了悬赏问题火爆全网的“元宇宙”到底是什么?预计能赚取 1积分收益
    酒后略带风情:发布了悬赏问题Android内存中Graphics与Code占用过高预计能赚取 10积分收益
    扛起拖把扫天下:发布了悬赏问题typescript如何导出接口配置?求解,谢谢!预计能赚取 10积分收益
    发布了悬赏问题Vue 如何改变返回页面的路径?如让B页面只能返回到A页面.预计能赚取 11积分收益
    发布了悬赏问题vue H5移动端;底部bottom固定定位,安卓弹起键盘导致页面变形如何解决?预计能赚取 10积分收益
    发布了悬赏问题请问为什么tomcat8.5 GET请求中文正常,POST请求还需要设置UTF-8.预计能赚取 10积分收益
    发布了悬赏问题vue2.5+ts创建以及引入jq的方法预计能赚取 11积分收益
    情场浪女:发布了悬赏问题import ggplot时报错module 'pandas' has no attribute 'tslib'预计能赚取 10积分收益
    见心书画许老师18753375161:发布了悬赏问题echarts3 legend禁止点击事件,允许悬浮事件预计能赚取 11积分收益
    aa_92cb0bd09f:发布了悬赏问题codewar上的一个问题预计能赚取 11积分收益