-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Online mode redirected to emulators #76
Comments
The firestore emulator runs at
And then I think you want to prefix your test command with With this setup I have successfully written to the local emulated Firestore from a cloud function. I am, however, having trouble with my specific use case, which is a function triggered by a Firestore |
This is a very cool feature request, but is definitely not trivial. We'll leave it on the back burner for now, but I don't know that we'll ever get to it. |
@inlined I would argue that this feature is pretty vital at least to my project. Because you need the service account key, you can't run your tests in CI without exposing your API key to the CI provider. You would also have to store the key in your repository for the same reason, which may not always be optimal (you may not want to share the key with everyone who has access to the project). |
We're working on support for sensitive secrets. That might solve your needs without being this particular feature request. For better or worse, we're busy with some major things coming down the pipeline and they'll all take precedence over this feature request. |
@inlined No problem, good luck with those! |
I concur that if online mode can be connected to the emulator, that will be great. But I can see that this is not trivial. For one thing, in online mode, the cloud function is not attached to the emulator. This allows debugging on the function code and produce code coverage, for example. But if the function modifies database using the |
I'm also trying to write tests of my firebase functions, but it's giving me errors because (I'm assuming) it doesn't have admin credentials in the emulator. Is that what this bug is about? Is there a way to emulate admin credentials in FirebaseFunctionsTest() using the emulator? |
I am attempting to follow the tutorial provided here:
https://firebase.google.com/docs/functions/unit-testing#online-mode
This code block defines where the firebase services are found on the network, as well as what auth creds to use:
We are trying to write our tests to interact with firebase emulator services. For example, we wish for the test suite to interact with our local emulated version of firestore.
We have been banging our heads trying to get this suite to redirect to local services without success. I would sincerely appreciate any guidance.
The text was updated successfully, but these errors were encountered: