Skip to content

RicardoTaipe/Testing-NodeApp-Jest

Repository files navigation

Testing Node App with Jest

Using Jest and Supertest to add unit and functional test to Node App.

Test
Api Demo Result
image image

Useful npm scripts

Run the tests

There are two types of tests, the unit tests and the functional tests. These can be executed as follows.

  • Run unit tests only

    $ npm run test:unit
  • Run functional tests only

    $ npm run test:functional
  • Run both unit and functional tests

    $ npm run test

Run the application

Run the application which will be listening on port 3000.

$ npm start

Useful docker comands

Run docker compose

There are two environments in Docker Compose. These can be executed as follows.

  • Run development environment

    $ docker-compose -f docker-compose.dev.yml up --build
  • Run production environment

    $ docker-compose -f docker-compose.yml up --build
  • Run tests inside Docker container

    $ docker build -t node-docker --target test .

https://docs.microsoft.com/en-us/learn/modules/deploy-nodejs/ https://github.com/MicrosoftDocs/node-essentials

About

Applying unit and functional test to NodeJS App with Jest

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •