See:
See the Cloud Functions Hello World tutorial.
Note: in order for the tests to run properly, you'll have to deploy some of the sample functions:
gcloud functions deploy helloPubSub --trigger-topic $FUNCTIONS_TOPIC --runtime [YOUR_RUNTIME]
- Replace
[YOUR_RUNTIME]with the name of the runtime you are using. For a complete list, see the gcloud reference.
-
Read and follow the prerequisites.
-
Install dependencies:
npm install -
Set the following environment variables:
export FUNCTIONS_TOPIC=[YOUR_PUBSUB_TOPIC] -
Run the tests:
npm test