【问题标题】:Running CI tests that rely on firestore emulator运行依赖于 firestore 模拟器的 CI 测试
【发布时间】:2020-06-29 19:48:13
【问题描述】:

我有一些可以在 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 google-cloud-firestore github-actions firebase-cli


    【解决方案1】:

    请阅读documentation for starting the Firebase emulators。您将需要使用 emulators:exec <scriptpath> 参数:

    为 firebase.json 中配置的 Firebase 产品启动模拟器后,在 scriptpath 处运行脚本。脚本完成运行后,模拟器进程将自动停止。

    如果您将要运行的命令的名称传递给它,CLI 将在它准备好后为您运行该命令,然后在脚本完成时结束该过程。

    【讨论】:

    猜你喜欢
    • 2020-06-17
    • 1970-01-01
    • 2016-02-19
    • 2020-03-22
    • 1970-01-01
    • 2020-01-05
    • 1970-01-01
    • 1970-01-01
    • 2014-02-21
    相关资源
    最近更新 更多