Chapter 3. Installing Zombie.js and Mocha

By the end of this chapter you should be able to setup the base structure of a test environment for an application using Zombie.js and Mocha.

Topics covered in this chapter are:

You'll now be extending the to-do application you started building in the previous chapter and start providing it with the ability to test itself.

In the root of the application, you have a file named package.json that you already changed to introduce some modules that your application depends on. Now you need to add a new section that specifies the dependencies on other modules during the development and testing phase. This section is named devDependencies and is only installed by NPM if the NODE_ENV environment variable is not set to production. This is a good place to introduce the dependencies on modules that need to be there for running your tests.

First you need to add the mocha and zombie modules:

Then you will need to install these missing dependencies using NPM:

This will install these two modules and their internal dependencies inside the node_modules folder, making them available for your application at any time.