Skip to content

Template for having split up cloud functions with jest testing

License

Notifications You must be signed in to change notification settings

ecklf/firebase-functions-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Cloud Functions Boilerplate

Template for having split up cloud functions (triggers/endpoints) with included jest testing.

Usage

Requires firebase-tools:

$ npm i -g firebase-tools

Install all dependencies (node version should match package.json engines):

$ cd functions
$ nvm use # will read .nvmrc (default: v8)
$ yarn

Add your firebase project

$ firebase use --add

Add your service-account.json to the functions folder:

{
+    "type": "service_account",
+    "project_id": "",
+    "private_key_id": "",
+    "private_key": "",
+    "client_email": "",
+    "client_id": "",
+    "auth_uri": "",
+    "token_uri": "",
+    "auth_provider_x509_cert_url": "",
+    "client_x509_cert_url": "",
}

Fill in your API details in config/*.json

Development: firebase serve with hot-reloading

$ yarn dev

Testing: jest

$ yarn test

Config

Node.js v10

Currently in beta. If you want to try it out you will need to enable it in your package.json

   "engines": {
-     "node": "8"
+     "node": "10"
   },

Also modify your .nvmrc if you use nvm / fnm / fish-nvm

-  v8
+  v10

Useful links

License

MIT

About

Template for having split up cloud functions with jest testing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published