Closed lazywithclass closed 8 years ago
Yeah unfortunately I'm pretty sure you really can't run Mocha tests without the Mocha executable. 99.9% sure that's the culprit here. The API you're using isn't documented (http://mochajs.org/#require) so I'm not even quite sure how they intend it to behave. Unfortunately my only recommendation is to use a test tool without global magic (e.g. tape) which is probably not what you wanted to hear.
I got to that usage of Mocha after reading this https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically
I could possibly use that require way, but then it would mean writing to files, which is what I'm trying to avoid with this approach. Well, I'll have to dig deeper, thank you for your prompt answer nonetheless.
Cheers
Got it. Either way, Mocha's making the requires for you. The only thing you could try is setting @global = true
on the value in stubs.fn
so that Mocha's side effects (possibly) get a stubbed dep from the module cache.
I didn't understand your suggestion, sorry, could you please give an example?
fn['@global'] = true
proxyquire('./test', {fn: fn})
function fn () {}
Got it, thanks ;D
Hello, thanks for this library!
I am having a look at it if I can use it for a mutation testing tool I am writing. I am experimenting with the following setup:
When running
node runner.js
I am gettingso I suppose something is happening, but I am probably doing something really silly here, do you see anything I might be missing? Any hint or help would be much appreciated, thanks.