Mocha: getting started

I see I’ve only done Mocha in an AWS context, so let’s have a go at Mocha, and Chai as the assertion framework.

Mocha

For Mocha, you can kick off here.

Plus, the Gist here is a beautiful, simple example of asynchronous testing.

Chai

And here for Chai.

Mocha examples on GitHub
Looks pretty good here. I see they have standardised on Unexpected assertion library. If that’s the Mocha line, maybe I won’t go with Chai.

MochaUnexpected01

 

I cloned the whole thing as [git clone https://github.com/mochajs/mocha.git%5D. I then [npm install] and then [npm test]. I was interested that there was a failure in the build due to not finding a file [cairo.h], this a number of times.

MochaUnexpected03

MochaUnexpected02

Advertisements