DEV Community

loading...

Running multiple instances of the Firebase Emulator

wceolin profile image Will Ceolin ・1 min read

When doing local development using the Firebase Emulator, it might be useful to run multiple instances of the emulator.

For example, I like to keep one instance of the emulator running for interactive development and another one for running my automated tests in the background.

You can run another instance of the emulator by passing a different configuration file using the --config file:

firebase emulators:exec --project testing --config="./firebase.test.json" 'jest'
Enter fullscreen mode Exit fullscreen mode

Then, make sure to change the default ports in your firebase.test.json file:

{
  "emulators": {
    "auth": {
      "port": 9098
    },
    "functions": {
      "port": 5002
    },
    "firestore": {
      "port": 8081
    },
    "database": {
      "port": 9001
    },
    "pubsub": {
      "port": 8086
    },
    "ui": {
      "enabled": true,
      "port": 4001
    }
}
Enter fullscreen mode Exit fullscreen mode

That will allow you to run two instances of the Firebase Emulator at the same time.

Discussion (0)

pic
Editor guide