2

I have some security tests that I can run locally on the firestore emulator. The process looks like this:

In terminal tab 1, start the emulator:

firebase emulators:start --only firestore

In terminal tab 2, run the tests

yarn test rules

I would like to run these tests as GitHub Actions for CI. It currently looks like this:

- name: Test Security Rules
  run: |
    firebase emulators:start --only firestore
    yarn test rules

The issue is that starting the emulators doesn't return so it hangs and eventually times out.

emulators: All emulators started, it is now safe to connect.

I am hoping to find out how to start the emulator, know when it is ready (or wait N seconds), run the tests, and then (optionally) close the process.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Jon Sakas
  • 2,042
  • 1
  • 21
  • 26

1 Answers1

2

Please read the documentation for starting the Firebase emulators. You will want to use the emulators:exec <scriptpath> argument:

Run the script at scriptpath after starting emulators for the Firebase products configured in firebase.json. Emulator processes will automatically stop when the script has finished running.

If you pass it the name of the command to run, the CLI will run that command for you after it's ready, then end the process when the script is complete.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • have you success doing this? I still trying to make this running on Github Actions... See my post.. https://stackoverflow.com/questions/62055310/run-firebase-emulators-on-github-actions And posted issue on github .. https://github.com/w9jds/firebase-action/issues/43 – ridermansb May 31 '20 at 18:31