xdissent/karma-browserify — pull request #14 by gr2m (2013-11-29 12:46:08+00:00)
Title: adding custom prelude to allow for stubbing require calls

This is quite a hack, rather quick than elegant. I'd like to
use it to discuss if such a feature (probably with a more
elegant API) would be something worth adding to karma-browserify?

For me personally, it would make a lot of sense, and my dev life
much easier. Let me know what you think.

Current API is as follows:

```js
carMock = require('mocks/car')
global.stubRequire('path/to/car', carMock)

doSomethingThatRequiresCar()
expect(carMock.featur).to.be.called()

// revert the stub
global.unstubRequire('path/to/car')
```

makes sense?