Running Firestore local e.g. for testing

前端 未结 7 934
盖世英雄少女心
盖世英雄少女心 2021-02-02 07:36

Is there a way to run firestore locally (e.g. for testing purposes)?

What would the approach to write tests against the DB (except of using mocks)

7条回答
  •  春和景丽
    2021-02-02 08:22

    You can run the Firestore emulator by running:

    gcloud beta emulators firestore start

    and then set the FIRESTORE_EMULATOR_HOST environment variable as per the console output (e.g. run export FIRESTORE_EMULATOR_HOST=::1:8505).

    This requires the Google Cloud SDK and a Java 8+ JRE installed and on your system PATH.

提交回复
热议问题