Adding tests to the pipeline

Now that we have the pipeline in place, let's add a more meaningful process, such as integration testing. Since almost everything is in place, we just have to include two more pieces of information in our .travis.yml file—the MongoDB service and the test command:

language: node_jsnode_js:  - '10'sudo: requiredservices:  - docker  - mongodbscript:  - npm run test

Since we are going to handle more than one environment, that is, dev, test, and prod with different information, we should start working with a tool to help us handle environment variables. To do that, we will install the dotenv library:

$ npm install --save dotenv

Also, there are some adjustments to be made to the package.json file, because we are going to ...

Get Hands-On RESTful Web Services with TypeScript 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.