We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I created SO post about this here: https://stackoverflow.com/questions/55976172/how-to-use-rewire-to-mock-dependencies-of-nested-exports
But maybe it makes more sense to post this question here.
// a.js var evil = require('evil'); module.exports = () => { evil.castCurse(); };
// b.js var Evil = require('evil'); module.exports = () => { Evil.castCurse(); };
// main.js var a = require('a.js'); var b = require('b.js'); module.exports = { a, b };
So my question here is - how can I employ a shim over both evil and Evil if I load main-spec.js as:
// main-spec.js var rewire = require('rewire'), main = rewire(../../../main.js'); main.__set__('Evil', {}); main.__set__('evil', {});
Would I have to do something closer to this?
// main-spec.js var rewire = require('rewire'), main = rewire(../../../main.js'); main.__get__('a').__set__('evil', { castCurse: () => { console.log('lucky a!'); }}); main.__get__('b').__set__('Evil', { castCurse: () => { console.log('lucky b!'); }});
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I created SO post about this here: https://stackoverflow.com/questions/55976172/how-to-use-rewire-to-mock-dependencies-of-nested-exports
But maybe it makes more sense to post this question here.
So my question here is - how can I employ a shim over both evil and Evil if I load main-spec.js as:
Would I have to do something closer to this?
The text was updated successfully, but these errors were encountered: