简体   繁体   中英

Import fixtures into running firebase emulator

I'm using emulator to run my unit tests, with fixtures to run more easily my integrations and units tests:

firebase emulators:start  --import=../fixtures/unit-tests

But when I'm writing something throught my test to firebase emulator, I cannot clear the data without removing all the fixtures.

For eg. there is this command:

firebase.clearFirestoreData({
  projectId: "my-project"
});

But this will remove all my data (fixture included). I want to clear my database without deleteting fixtures.

TLDR:

Is there a way to re-import fixtures into a running emulator or clear data without deleting fixtures?

I would suggest using the AdminApp abilities and store your fixtures as JSON files and create your collections before each test.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM