Angular CLI Unit Testing

This tutorial will show you how to run Unit Tests with Angular CLI along with the Angular Components by jQWidgets.

First we will need to have an Angular CLI project set up. For that we will use the Create jQWidgets Angular App.

NOTE: Create jQWidgets Angular App is set up for testing so we can directly run npm test.

When the set up is done, open the tsconfing.spec.json file, located in src folder and add the following line in the include property:


It should look like this:

Then we can go to the app.component.spec.ts file and write our first test:


All that's left is to run the command npm test and browser window with Karma will pop-up with the test results: