Test-driven Node.js Development

The code examples in The Node Beginner Book only described a toy project, and we came away with not writing any tests for it. If writing tests is new for you, and you have not yet worked on software in a test-driven manner, then I invite you to follow along and give it a try.

We need to decide on a test framework that we will use to implement our tests. A lack of choice is not an issue in the JavaScript and Node.js world, as there are dozens of frameworks available. Personally, I prefer Jasmine, and will therefore use it for my examples.

Jasmine is a framework that follows the philosophy of behaviour-driven development, which is kind of a subculture within the community of test-driven developers. This topic ...

Get The Node Craftsman Book now with the O’Reilly learning platform.

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