Prerequisites

Getting Started

First things first: Please open a terminal, navigate to the folder called “azure-functions” and run

npm install

to download all NodeJS packages that our program needs. Now, you are able to run all necessary commands to develop and test this program.

In the following, we are always executing bash commands in the folder azure-functions.

Looking into “azure-function/package.json”, you will see many scripts that can be run via

npm run <script-name>

E.g.

npm run watch

will run a typescript command to automatically convert all typescript files into javascript files and save them to the folder “azure-functions/dist” once in the beginning and then on every file change.

The most important commands are npm run watch to let all typescript files be converted into JavaScript files, npm run start or npm start to start a local Azure Functions instance that listens to defined triggers and npm run test or npm test for running all tests.

Running the functions

In case you want to use npm start, it is important to note that another command needs to be executed on another console to start all other Azure services that our Azure functions need. For this, open a terminal and run:

npx azurite --location ./.azurite

In order to have everything up and running and for changes to take direct effect on your functions, you need to have three consoles running:

  1. A console running npm run watch.
  2. A console running npx azurite --location ./.azurite.
  3. A console running npm start.

(The use of background tasks is not recommended since all outputs might be important and shall not overlap each other.)

After all those processes are run, you can send HTTP Requests to trigger the defined HTTP triggers. This can be done using for example the prepared HTTP requests in requests/functions.http.

Running tests

If you want to run tests that establish a connection to the SharePoint or the Power BI Database, then defining the following environment variables is necessary:

export SHAREPOINT_CLIENT_ID="<my client id>";
export SHAREPOINT_TENANT_ID="<my tenant id>";
export SHAREPOINT_CLIENT_SECRET="<my client secret>";

Those variables can be found in the 1Password Vault that is linked in the above mentioned slack channel.

Now, just run

npm test

If you only want to run Feature Tests written in Cucumber, use

npm run cucumber

instead.

Now, you are ready to develop this application!