O'Reilly logo

Node Cookbook Second Edition by David Mark Clements

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

Creating a test-driven module specification

We're going to create our module by loosely following the test-driven development (TDD) model (refer to http://en.wikipedia.org/wiki/Test-driven_development for more information). JavaScript is asynchronous, so the code can be executed in multiple time streams at once. This can sometimes make for a challenging mental puzzle.

A test suite is a particularly powerful tool when it comes to JavaScript development. It provides a quality assurance process and inspires confidence in a module's user base when tests are passing.

What's more, we can define our tests upfront as a way to map out the intended API before we even begin development.

In this recipe, we'll be doing just that by creating a test suite for a ...

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