Chapter 12. Testing Angular.js
In the previous two chapters, you wrote an end-to-end test with Protractor and tests for the Node server. Now you’ll look at writing tests on the client side for Angular.
Using Karma
Much like end-to-end tests have Protractor as the runner, Angular tests make use of Karma. Karma is a test runner designed for unit testing. It can also run in multiple browsers, including Chrome, Firefox, and PhantomJS. Built by the Angular team like Protractor, Karma has a similar configuration setup and ways to run it.
The biggest difference with Karma is that you’re usually not working with the DOM, so the UI isn’t important. In fact, you won’t even be using your layout file. For this reason, most developers run Karma under a ...
Get Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.