node.js - Firebase 远程配置不适用于单元测试中的 NodeJS
问题描述
我创建了一个使用 Firebase 远程配置的函数。一切正常npm run start
。但是当我尝试运行所有单元测试用例时,它不再起作用了。以下是我用来导入库的代码:
// This import loads the firebase namespace along with all its type information.
import * as firebase from 'firebase/app';
// These imports load individual services into the firebase namespace.
import 'firebase/remote-config';
但是,当我尝试使用 command 运行单元测试时npm run test
。它通过一个异常:
Test suite failed to run
(node:18099) UnhandledPromiseRejectionWarning: ReferenceError: indexedDB is not defined
(node:18099) UnhandledPromiseRejectionWarning: Unhandled promise rejection. 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(). (rejection id: 2)
你们对如何解决这个问题有任何想法吗?谢谢。
解决方案
推荐阅读
- regex - 匹配模式不在字符串之前或之后
- javascript - 在使用 lat 和 long 参数时点击 openweathermap api 后未收到任何数据
- html - 如何在常规图像上复制这种放大/缩小效果?
- reactjs - 根据 React 状态更新 CkEditor 配置
- android-studio - 为一个活动的多个片段重用片段的布局
- c++ - 没有实例的基类?
- app-inventor - 如何在 MIT App Inventor 中显示具有透明背景的动画 gif?
- excel - 如何更改列中下一个空单元格的值?
- android - 无法在 Android 中获取 JSON 数据 [使用 volley Library]
- android - “预期为 BEGIN_OBJECT,但为 BEGIN_ARRAY”错误