我有一些可以在Firestore模拟器上本地运行的安全测试。该过程如下所示:
在终端选项卡1中,启动仿真器:
firebase emulators:start --only firestore
在终端选项卡2中,运行测试
yarn test rules
我想将这些测试作为GitHub Actions for CI运行。当前看起来像这样:
- name: Test Security Rules
run: |
firebase emulators:start --only firestore
yarn test rules
问题是启动仿真器不会返回,因此挂起并最终超时。
emulators: All emulators started, it is now safe to connect.
我希望找到如何启动模拟器,知道何时准备就绪(或等待N秒),运行测试,然后(可选)关闭该过程的方法。
请阅读有关启动Firebase模拟器的文档。您将需要使用emulators:exec <scriptpath>
参数:
为firebase.json中配置的Firebase产品启动模拟器后,在scriptpath上运行脚本。脚本完成运行后,仿真器进程将自动停止。
如果您将要运行的命令的名称传递给它,则CLI将在命令准备就绪后为您运行该命令,然后在脚本完成后结束该过程。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句