Mocha is a wonderful testing framework for node.js, however the documentation seems to be lacking.

When I first begin to write in Mocha, I had many questions:

  • what exactly does describe() do?
  • what is the effect of nesting describe() multiple levels?
  • is describe() a test suite, and it() a test case?
  • where should I place before() and after() hooks?

I didn’t find the answer online, hence I simply test it out myself.

This gist is the javascript that explains the questions I had. Much clearer now :)

I also used docco to generate a more-pleasing-to-read documentation for the gist.

Sorry but I didn’t host the docco documentation, but you could still read the javascript in it’s purest form:




Back to Home