O'Reilly logo

Beginning Node.js by Basarat Ali Syed

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

CHAPTER 12

image

Testing

I never make stupid mistakes. Only very, very clever ones.

—John Peel

Testing is an integral part of any successful software development life cycle. It ensures that defects are noticed as early as possible. It also prevents feature regressions where things you know to work right now can break because of new code. In this chapter, we will look at various libraries that help test Node.js applications.

Assert

Node.js comes with assert as a core module, which you use simply as require('assert'). The main objective of assert is to provide you with simple logic checks to throw errors based on invalid situations. Consider the simple ...

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