emanuelefavero / jest

This repository is for try out the Jest Javascript testing framework.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jest

This repository is for try out the Jest Javascript testing framework.

Installation

npm install

Usage

Test:

npm test

Test specific file: npm test sum.test.js OR npm test sum

Test with in depth coverage:

npm run test:coverage

Test in watch mode:

npm run test:watch
  • You can also use yarn instead of npm (the commands are the same)

  • test:coverage will generate a "lcov-report" directory with reports in html files (index.html), useful if you need to show the results to your colleagues

  • You can also skip tests with test.skip() method

Unit testing

While using Jest, it is recommended to use the technique of unit testing

  • Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation.

  • Generally it is a bad practice to create big and complex jest tests, the reason is when a test eventually fails it will be harder to know the source of the problem

About

This repository is for try out the Jest Javascript testing framework.


Languages

Language:JavaScript 100.0%