November 2013
Intermediate to advanced
148 pages
3h 12m
English
Let’s create a unit test for our RDF parser module. This will confirm that it does what we believe it should, and will give us an opportunity to see how to do unit testing in Node.
There are many unit-testing frameworks available through npm. A few of the most popular ones are mocha,[22] vows,[23] and nodeunit.[24] We’ll use nodeunit because it’s a relatively simple unit-testing framework, with support for asynchronous tests and deep equality checks.
Many Node modules are meant to be used as a library, but some modules, like nodeunit, are intended to run as stand-alone programs on the command line, too. To install such a module globally, use npm’s -g flag:
| | $ npm install -g nodeunit |
You can confirm that it has been ...
Read now
Unlock full access