Unit testing of Angular applications using Jest
When you add an Angular project to your Nx monorepo, the application is set up to use Jest as a test runner by default. Jest is a testing framework commonly used to write and run automated unit tests for JavaScript and TypeScript-based applications. This section will give you hands-on experience writing unit tests for your Angular application using Jest. Before you start writing tests, let’s expand upon the default configuration Nx provided to make your testing experience better.
Setting the coverage threshold
The first thing you want to add in the Jest configuration is a coverage threshold for the minimum required percentage of lines, functions, and branches that unit tests should cover. A commonly used percentage is 80%, but you can set the coverage percentages to whatever you and your team deem enough to make you confident that new changes won’t break existing code. You can add the global configurations for testing...