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.
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.