This repository is for try out the Jest Javascript testing framework.
npm install
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 ofnpm
(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
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