I\'m using the expect.js library with my mocha unit tests. Currently, I\'m requiring the library on the first line of each file, like this:
var expect = require
You are requiring the module properly but as you figured out, the symbols that the module export won't automatically find themselves into the global space. You can remedy this with your own helper module.
Create test/helper.js
:
var expect = require("expect.js")
global.expect = expect;
and set your test/mocha.opts
to:
--require test/helper