mfncooper / mockery

Simplifying the use of mocks with Node.js
Other
1.1k stars 60 forks source link

Support require.resolve to not return the path. #42

Open nicolasgramlich opened 8 years ago

nicolasgramlich commented 8 years ago

Ideally, we would be able to also have require.resolve return something different than the actual implementation.

I.e. I'm trying to check for the absence of a module. And in my code, after mocking via mockery.registerMock('koa-bodyparser', null); the require.resolve('koa-bodyparser') still returns the actual path, where require('koa-bodyparser') returns null.

To allow the best of both ways, this could be an config option to mockery.

Thanks!

klausbayrhammer commented 7 years ago

+1

ah584d commented 6 years ago

does it has been implemented? i really need it