[英]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.但是,当我通过对 firebase 仿真器的测试编写一些东西时,如果不删除所有固定装置,我就无法清除数据。
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: 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.我建议使用 AdminApp 功能并将您的夹具存储为 JSON 文件,并在每次测试之前创建您的 collections。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.