You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用React Testing Library测试含LazyLoadImage组件时报错TypeError

React Testing Library测试含LazyLoadImage组件时出现TypeError问题求助

我在使用React Testing Library进行测试时,发现当渲染的组件包含来自react-lazy-load-image-component的LazyLoadImage时,出现错误:
TypeError: Cannot read properties of undefined (reading 'prototype')

错误截图:
错误截图

渲染组件的代码片段截图:
组件代码片段截图

若有遇到相同问题并找到解决方案的朋友,恳请分享,谢谢。

内容的提问来源于stack exchange,提问作者Wisnu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.20 13:01:55