As the Cloud Functions run on a Node.js environment, we can build and test our application locally just using a Node.js emulator with development tools. The emulator is an open source and code is hosted on the GitHub. Let's look at how to use it:
- Install the emulator through npm or Yarn; you need to make sure you have Node.js installed on your machine:
$ npm install -g @google-cloud/functions-emulator/usr/local/bin/functions-emulator -> /usr/local/lib/node_modules/@google-cloud/functions-emulator/bin/functions /usr/local/bin/functions -> /usr/local/lib/node_modules/@google-cloud/functions-emulator/bin/functions> @google-cloud/functions-emulator@1.0.0-beta.4 postinstall /usr/local/lib/node_modules/@google-cloud/functions-emulator ...