Headless website testing with ZombieJS and Mocha
Even though we are working on the server with Node, there is no doubt that much of what we are programming will affect those connecting to our services via a browser. As it is expected that we will be using Node to test our server-side code, why not integrate browser-side testing as well?
We'll dig deeper into how to unify the entire make/build/test/deploy chain in the next section. For now, let's look into the easy to use Mocha testing framework and how some simple browser testing can be done right from the server.
Note
The libraries we will use in this section and the next are available through the following sources:
Grunt: http://www.gruntjs.com/
ZombieJS: http://zombie.labnotes.org/
PhantomJS: http://www.phantomjs.org/
Mocha
Mocha expects a directory containing testable units to contain a /test
directory, within which exist various spec, or test specification and files, making up the suite of tests that...