Skip to Main Content
Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js
book

Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js

by Jeff Dickey
September 2014
Intermediate to advanced content levelIntermediate to advanced
256 pages
5h 25m
English
Peachpit Press
Content preview from Write Modern Web Apps with the MEAN Stack: Mongo, Express, AngularJS, and Node.js

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Node.js, MongoDB, and AngularJS Web Development

Node.js, MongoDB, and AngularJS Web Development

Brad Dayley

Publisher Resources

ISBN: 9780133962369Purchase book