JavaScript does not have all the niceties of a strongly typed language like type safety and a compiler. That puts the onus on us developers to ensure that what we write actually works as intended, and continues to run as intended well into the future. Unit tests provide a way to write expectations about how code should behave, and running them in an automated way ensures that behaviors don’t change unexpectedly.

Because angularjs and testing are so well integrated, we introduce a small chapter on testing after each major concept to show how each concept can be unit tested independently, and in isolation. We also dive into Karma, the unit test runner for angularjs, and Jasmine, the test framework. Finally, we bring all these pieces together to write our first angularjs unit test.