簡體   English   中英

運行依賴於 firestore 模擬器的 CI 測試

[英]Running CI tests that rely on firestore emulator

我有一些安全測試可以在 Firestore 模擬器上本地運行。 該過程如下所示:

在終端選項卡 1 中,啟動模擬器:

firebase emulators:start --only firestore

在終端選項卡 2 中,運行測試

yarn test rules

我想將這些測試作為 CI 的 GitHub Actions 運行。 它目前看起來像這樣:

- 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 將在它准備好后為您運行該命令,然后在腳本完成時結束該過程。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM