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
Copy file name to clipboardExpand all lines: lib/index.js
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,30 @@
1
1
varrewireModule;
2
2
3
3
/**
4
-
* This function is needed to determine the calling parent module.
5
-
* Thus rewire acts exactly the same like require() in the test module.
4
+
* Adds a special setter and getter to the module located at filename. After the module has been rewired, you can
5
+
* call myModule.__set__(name, value) and myModule.__get__(name) to manipulate private variables.
6
6
*
7
-
* @param {!String} request Path to the module that shall be rewired. Use it exactly like require().
7
+
* @param {!String} filename Path to the module that shall be rewired. Use it exactly like require().
8
8
* @param {Boolean} cache Indicates whether the rewired module should be cached by node so subsequent calls of require() will return the rewired module. Subsequent calls of rewire() will always overwrite the cache.
9
9
* @return {*} the rewired module
10
10
*/
11
-
functionrewire(request,cache){
12
-
deleterequire.cache[__filename];// deleting self from module cache so the parent module is always up to date
0 commit comments