【发布时间】:2022-01-31 01:06:46
【问题描述】:
我使用 Create React App 创建了一个 React App,它使用 IndexedDB。
当我尝试运行测试时出现此错误:
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "ReferenceError: indexedDB is not defined".] {
code: 'ERR_UNHANDLED_REJECTION'
}
我了解测试套件是在没有 IndexedDB 的无头浏览器中运行的。
我该如何处理这种情况?
【问题讨论】:
标签: javascript reactjs jestjs react-testing-library indexeddb