Closed matthewrobertson closed 2 years ago
It would help to have more details as to how this interface is expected to be used here. This utility is useful.
This PR is large, substantial, and external-facing. It includes both implementation and documentation. Here's an example PR description that would help:
feat: add testing helpers and instructions
This PR blocks https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/2428
Feat:
@google-cloud/functions-framework/testing
package
Docs:
This content should not go in our docs because of X, Y:
I plan to write this testing guide for Node.js only. We'll follow-up with each language individually.
We typically defer heavier documentation to DevSite docs as there can be a mix of guidance.
@grant currently none of our Node.js docs on DevSite are using the declarative function signature APIs, so this guide and the testing
module are incompatible with those docs / samples. Once we update all (most?) of the other docs on DevSet to use declarative I think we should update this guide to align it with the docs and helpers I am adding here. The plan for that is still TBD so I think checking some docs in here is a good interim solution.
Also FWIW the dotnet and ruby repos already include similar markdown docs that cover testing functions.
This commit adds some helpers for unit testing cloud functions along with some documentation about how to use them. Much of inspiration came from the Ruby Functions Framework: https://github.com/GoogleCloudPlatform/functions-framework-ruby/blob/main/docs/testing-functions.md
A readable preview of the docs is here.
Eventually we will want to update this guide on DevSite to match the guidance in the docs we are adding in this PR; however, at the moment none of our public docs or samples are using the declarative function signature APIs so the helpers / instructions here are not compatible. Once the majority of the nodejs public documentation is updated to use the declarative APIs we can update the testing guide.
I also refactored some of our out tests to use the helpers.
Fixes #387