jmreidy/grunt-mocha-webdriver — pull request #6 by mlmorg (2013-08-02 21:07:59+00:00)
Title: Ability to call a function in the pre-require block

Adds the ability to pass a function in the task options that is called
in the pre-require block of the mocha runner.

I find that this can be useful to set up the mocha environment. For example, if I want to include Chai in all of my tests:

``` javascript
mochaWebdriver: {
test: {
options: {
usePhantom: true,
prerequire: function (context) {
context.expect = Chai.expect;
context.assert = Chai.assert;
Chai.should();
}
},
src: ['test/**/*.js']
}
}
```

You could also just pass a module:
``` javascript
prerequire: require('test/setup.js')
```