mo_ocha
Use monocle-js to write asynchronous mocha code without callbacks or remembering to pass "done" everywhere!
Install:
npm install mo_Ocha
Then:
var mo_Ocha = it = mo_Ochait before = mo_Ochabefore should = ; ;
(Where in the example above, doSomeTestSetup
and myAsyncMethod
are monocle-js o-routines or promises)
Running tests written this way is easy: simply run mocha
with the --harmony
flag:
mocha --harmony my-specs.js
Notice that we're simply redefining it
and before
to clobber Mocha's built-in one. We could also have simply done this:
;
Which rewrites the it
, before
, beforeEach
, after
, and afterEach
globals.
Run tests for this project:
make test