Using unit tests

Unit tests are a funny subject. It seems that everyone agrees that it is good to write tests, but few people actually do it. A complete examination of unit testing would take an entire book but, hopefully, we can cover just enough about unit tests to show you how to add them to your code and explain why you should.

My preferred unit test framework is Jasmine, http://jasmine.github.io/. This is not to slight any of the other fine frameworks available, but Jasmine works on the frontend and backend, works in the browser and the command line, is actively maintained, and does all one would want from a test framework. Keep in mind that while the code is written for Jasmine, the principles can be applied to any JavaScript unit test framework. ...

Get jQuery Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.