O'Reilly logo

CoffeeScript Application Development Cookbook by Mike Hatfield

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 with QUnit

QUnit is a popular testing framework for JavaScript that supports a Test Driven Design (TDD) approach to writing tests.

When using QUnit, we write our tests in the form of CoffeeScript functions that describe our desired functionality. When these tests are run, the QUnit test runner will execute our tests against our application's code and display the test results.

In this recipe, we will demonstrate how to configure QUnit and write a variety of tests to verify that our CoffeeScript code is working as expected.

Getting ready

We will begin by downloading the QUnit package and configuring the test runner.

QUnit can be installed in a variety of ways. We will be using Node's bower package installer to grab the QUnit files we need. ...

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