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 helloHttp --runtime nodejs8 --trigger-http
gcloud functions deploy helloPubSub --trigger-topic $FUNCTIONS_TOPIC --runtime nodejs8
gcloud functions deploy helloGCS --runtime nodejs8 --trigger-resource $FUNCTIONS_DELETABLE_BUCKET --trigger-event providers/cloud.storage/eventTypes/object.change
-
Read and follow the prerequisites.
-
Install dependencies:
npm install -
Set the following environment variables:
export GCF_REGION=us-central1 export FUNCTIONS_TOPIC=[YOUR_PUBSUB_TOPIC] export FUNCTIONS_DELETABLE_BUCKET=[YOUR_CLOUD_STORAGE_BUCKET] # will be deleted by tests! -
Run the tests:
npm test