Open 3den opened 9 years ago
That's basically exactly what proxyquire's API looks like. Have you tried it?
I never tried proxyquire
but it looks very similar to what i am currently doing with mockery the main difference is that proxyquire returns an object with the mocked stuff and the mockRequire
gives you a callback to do whatever you want.
I think that implementing something like what was suggested above on mockery would still be helpful. But thanks for the suggestion :+1:
I have been working mockery for some time but since the core API is verbose we have create a wrapper to simplify the use of mockery but i think it would be nicer to have something like that merged in the official repo.
The advantage is because you can mock several modules at once and there is not need to use before/after hocks. This feature is very useful for the projects I am working and I would be glad to submit a PR.