Search code examples
node.jsfirebasefirebase-cli

Prevent firebase emulator closing on finishing the tests


I am running my firebase tests using the following command

firebase emulators:exec --ui 'mocha --reporter spec --timeout 10000'

but the ui closes and emulators shut down as soon as the test finishes. I have looked at the params in the help but cant seem to find a way to keep them running so I can check values in the db.

I have tried starting the emulators first and then running with exec but it always complains that emulator instances are already running.

Is there a method of doing this?


Solution

  • You can try starting the firebase emulators:start and then running your test script after it has started

    mocha --reporter spec --timeout 10000
    

    It fails when you run exec after starting because the ports assigned to the emulators are busy.. Instead of running exec after the emulators have started, run the test script itself