Last active
December 19, 2015 13:19
-
-
Save andyperlitch/5961510 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var originals = {}; | |
| exports = module.exports = { | |
| registerMock: function(key, mock, module) { | |
| var map = module.map; | |
| var cache = module.cache; | |
| originals[map[key]] = cache[map[key]].exports; | |
| cache[map[key]].exports = mock; | |
| }, | |
| unregisterMock: function(key, module) { | |
| var map = module.map; | |
| var cache = module.cache; | |
| cache[map[key]].exports = originals[map[key]]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment