O'Reilly logo

Learning AngularJS for .NET Developers by Alex Pop

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Unit testing AngularJS components

We mentioned Karma before, the test runner for unit tests. This is the primary tool to run tests that target specific AngularJS components. We can add it to our application by creating a Node.js console project and then use npm to install the required packages.

Note

Karma can also run generic JavaScript tests and be used as a very fast non-AngularJS test runner. More details can be found at http://karma-runner.github.io.

Installing Karma

To install Karma, we first need to create a blank Node.js console application. The name I used for the main sample application AngularJS test project was RentThatBike.Tests.Nodejs. A package.json file was created for us in this project that contains metadata information such as project ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required