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 ...

Get Beginning Node.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.