Book Image

Mastering Web Application Development with Express

By : Alexandru Vladutu
Book Image

Mastering Web Application Development with Express

By: Alexandru Vladutu

Overview of this book

Table of Contents (18 chapters)
Mastering Web Application Development with Express
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing toolbox


There are a handful of modules in NPM that can help us out when testing our applications, but in the next few lines we are going to focus on some of the most used ones:

  • Mocha: This is a popular test framework for Node and for the browser created by the author of Express, TJ Holowaychuk

  • should.js: This is an assertion library, which is framework agnostic

  • sinon: This is a library that provides spies, stubs, and mocks, and it works in Node and the browser

  • supertest: This is a high-level abstraction module for testing Node HTTP servers with a fluent API

  • proxyquire: This is a simple library for mocking the required dependencies

Mocha

Mocha is one of the most feature-rich JavaScript testing frameworks. It has features such as multiple interfaces (such as behavior-driven development or test-driven development), multiple reporters, and runs asynchronous tests and specifies timeouts (for different levels). For more details, you can find the full documentation of the project page at...