Firebase 如何使用Firestore测试云功能?

Firebase 如何使用Firestore测试云功能?,firebase,google-cloud-functions,google-cloud-firestore,Firebase,Google Cloud Functions,Google Cloud Firestore,我正在尝试测试云功能。 但是,在测试NPM运行测试中,我得到了这个错误 为什么我会犯这个错误?如何修复它 TypeError: Path must be a string. Received undefined at assertPath (path.js:7:11) at Object.join (path.js:1218:7) at database (node_modules/firebase-functions/lib/providers/firestore.js:36:45) at O

我正在尝试测试云功能。 但是,在测试NPM运行测试中,我得到了这个错误

为什么我会犯这个错误?如何修复它

TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:1218:7)
at database (node_modules/firebase-functions/lib/providers/firestore.js:36:45)
at Object.document (node_modules/firebase-functions/lib/providers/firestore.js:44:12)
at Object.<anonymous> (src/index.ts:6:21)
at Object.loadTypeScript (node_modules/espower-typescript/index.js:23:17)
at require (internal/module.js:20:19)
at Context.before (test/initialize-pair.ts:19:23)

谢谢

看起来您正在运行npm运行测试,而不了解您的特定测试脚本实际应该做什么。Firebase CLI没有提供用于自动测试功能的npm脚本

如果要对函数进行单元测试

如果要使用本地仿真器手动模拟函数中的事件,.

npm运行测试应该做什么?这不是Firebase安装的云函数的正常脚本。哦,我刚刚在Functions/packages.json中找到了测试。本地测试的正常脚本是什么。
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp(functions.config().firebase);
export const aFunc = functions.firestore.document('/users/{uid}').onUpdate(() => { console.log('called')});