You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
-*{!String} filename*: Path to the module that shall be rewired. Use it exactly like require().
103
-
-*{Object} mocks (optional)*: An object with mocks. Keys should be the exactly the same like they're required in the target module. So if you write```require("../../myModules/myModuleA.js")``` you need to pass```{"../../myModules/myModuleA.js": myModuleAMock}```.
104
-
-*{Object|String} injections (optional)*: If you pass an object, all keys of the object will be```var```s within the module. You can also eval a string.**Please note**: All scripts are injected at the end of the module. So if there is any code in your module that is executed during```require()```, your injected variables will be undefined at this point. For example: passing```{console: null}``` will cause all calls of```console.log()``` to throw an exception if they're executed during```require()```.
105
-
-*{Array<String>} leaks (optional)*: An array with variable names that should be exported. These variables are accessible via```myModule.__```
106
-
-*{Boolean=true} cache (optional)*: Indicates whether the rewired module should be cached by node so subsequent calls of```require()``` will return the rewired module. Further calls of```rewire()``` will always overwrite the cache.
110
+
Returns the rewired module.
111
+
112
+
-*{!String} filename*: <br/>
113
+
Path to the module that shall be rewired. Use it exactly like require().
114
+
115
+
-*{Object} mocks (optional)*: <br/>
116
+
An object with mocks. Keys should be the exactly the same like they're required in the target module. So if you write`require("../../myModules/myModuleA.js")` you need to pass`{"../../myModules/myModuleA.js": myModuleAMock}`.
117
+
118
+
-*{Object|String} injections (optional)*: <br />
119
+
If you pass an object, all keys of the object will be`var`s within the module. You can also eval a string.**Please note**: All scripts are injected at the end of the module. So if there is any code in your module that is executed during`require()`, your injected variables will be undefined at this point. For example: passing`{console: null}` will cause all calls of`console.log()` to throw an exception if they're executed during`require()`.
120
+
121
+
-*{Array<String>} leaks (optional)*: <br/>
122
+
An array with variable names that should be exported. These variables are accessible via`myModule.__`
123
+
124
+
125
+
-*{Boolean=true} cache (optional)*: <br />
126
+
Indicates whether the rewired module should be cached by node so subsequent calls of`require()` will return the rewired module. Further calls of`rewire()` will always overwrite the cache.
127
+
128
+
**rewire.reset()**
129
+
130
+
Removes all rewired modules from`require.cache`. Every`require()` will now return the original module again. <br />**Please note:** You should call this before every unit test to ensure a clean test environment.