Skip to content

Latest commit

 

History

History
70 lines (62 loc) · 1.7 KB

CONTRIBUTING.md

File metadata and controls

70 lines (62 loc) · 1.7 KB

Contributing

Adding unit tests

Unit tests are able to be added to functions/tests/ and then executed via npm run test:watch (in the functions directory).

These are the fastest way to get feedback on your new code and functionality.

Using the Firebase Emulator

To use the firebase emulator, you'll need the following:

  1. A separate Firebase Project repository. This can be a bare bones project, but needs the following features enabled (see below for an example firebase.json):
    1. Firestore
    2. Authentication
    3. Functions
    4. Database
    5. Hosting
    6. UI
  2. This repository installed as a local extension to the Project, via the firebase ext:install PATH_TO_THIS_REPOSITORY
    1. This will walk you through the set up, similar to the Firebase Console.
    2. Make sure to specify a collection name
  3. Start the emulators locally with firebase emulators:start.
  4. You should then be able to add items to the collection you specified via the Firestore UI to test the triggers.

Example firebase.json

{
  "firestore": {
    "rules": "firestore.rules",
    "indexes": "firestore.indexes.json"
  },
  "functions": {
    "predeploy": [
      "npm --prefix \"$RESOURCE_DIR\" run lint",
      "npm --prefix \"$RESOURCE_DIR\" run build"
    ],
    "source": "functions"
  },
  "hosting": {
    "public": "public",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  },
  "emulators": {
    "functions": {
      "port": 5001
    },
    "firestore": {
      "port": 8080
    },
    "database": {
      "port": 9000
    },
    "hosting": {
      "port": 5000
    },
    "ui": {
      "enabled": true
    },
    "auth": {
      "port": 9099
    }
  }
}