我们有一个使用 Agora 进行通话/视频通话的 React 应用程序。我们还使用 Jest 库来运行我们的大部分测试。升级到标记为稳定的 Agora Web SDK NG(版本 4.0.1)后,我们在尝试使用 Jest 测试时收到一堆 Agora 错误(错误粘贴在下面)。
似乎 Agora 正在尝试检查浏览器的兼容性,但 Jest 在没有浏览器的情况下运行,所以这将永远失败(如果这就是问题所在)。有想法该怎么解决这个吗?由于我们正在使用 NG 功能,因此无法选择降级回以前的版本。
运行 Jest 时的错误:
AgoraRTCError NOT_SUPPORT: can not create audio context
console.error node_modules/agora-rtc-sdk-ng/AgoraRTC_N-production.js:375 16:17:09:618 Agora-SDK [错误]:您的浏览器不支持网络音频
console.error node_modules/agora-rtc-sdk-ng/AgoraRTC_N-production.js:375 16:17:09:619 Agora-SDK [错误]: AgoraRTCError NOT_SUPPORT: enumerateDevices() 不支持
console.warn node_modules/agora-rtc-sdk-ng/AgoraRTC_N-production.js:375 16:17:09:626 Agora-SDK [警告]:设备检测功能无法正常启动。AgoraRTCError NOT_SUPPORT:不支持 enumerateDevices()
console.error node_modules/agora-rtc-sdk-ng/AgoraRTC_N-production.js:375 16:17:09:626 Agora-SDK [ERROR]: TypeError: Cannot read property '_location' of null