Unit Test Manual

Create a new Unit Test

Our unit tests for every web component are based in the Angular's unit testing standard using the JEST runner.

How to run existing unit tests

To execute the existing unit tests use the npm run test command using the command line terminal.

If you want to see the coverage report for unit test use the npm run test command. It is configured to run the ng test command using some flags that generates the coverage report. Also you can manually run ng test using:

ng test --watch=false --code-coverage

The coverage report is generated in a folder called coverage in the root of the WebComponents project:

You can see the generated report opening the index.html file that is inside the coverage folder:

Currently there is a coverage threshold of 90%, therefore the build process will fail if you try to commit a component with less unit tests coverage.

If you want more info about how to create a unit test and the best practices, you can consult our documentation (Frontend Unit Testing).

Last updated