When we created our project using the Angular CLI, the CLI configured the setup for unit testing our code with Karma and Jasmine. It did so by adding several Karma and Jasmine modules to our project. It also added a Karma configuration file—karma.config.js—to the root directory of our application—trainer/—and a file called tests.ts in the trainer/src directory. The CLI makes use of these files at runtime to create the configuration for executing our tests. This means that we can run our tests by simply using the following command:
ng test
And the CLI will also watch our tests for changes and automatically rerun them.
We will not be covering the configuration files in detail here. The out-of-the-box settings will be fine for our purposes. Refer to the Karma documentation (http://karma-runner.github.io/1.0/config/configuration-file.html) to understand more about the various Karma configuration options.