Angular creates for every component, service or class a unittest file with the file ending
spec.ts. We use native Angular unittests (Angular uses Karma and Jasmine) with two additional libraries.
Google Chrome or Chromium should be installed.
To run tests use
To run tests with code coverage use
ng test --codeCoverage (Result will be in
- Angular Testing: https://angular.io/guide/testing
- Spectator Library (simplifies testing): https://github.com/ngneat/spectator/blob/master/README.md
- ng-mocks (mock Components and Pipes): https://github.com/ike18t/ng-mocks/blob/master/README.md
- Specific guide for Spectator: https://github.com/ngneat/spectator/blob/master/README.md#mocking-components