Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7f23481

Browse files
committed
Update master
1 parent 6e796d9 commit 7f23481

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ rewire("./myModuleA.js", null, null, null, false) === require("./myModuleA.js");
9595

9696
##API
9797

98-
**rewire(***filename, mocks\*, injections\*, leaks\*, cache=true*) \* = optional
98+
**rewire(***filename, mocks, injections, leaks, cache*)
9999

100-
- *{!String} **filename***: Path to the module that shall be rewired. Use it exactly like require().
101-
- *{Object} **mocks***: An object with mocks. Keys should be the exactly 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}```.
102-
- *{Object|String} **injections***: 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: {...}}``` will cause all calls of ```console.log()``` to throw an exception if they're executed during ```require()```.
103-
- *{Array<String>} **leaks***: An array with variable names that should be exported. These variables are accessible via ```myModule.__```
104-
- *{Boolean=true} **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.
100+
- *{!String} filename*: Path to the module that shall be rewired. Use it exactly like require().
101+
- *{Object} mocks (optional)*: An object with mocks. Keys should be the exactly 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}```.
102+
- *{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: {...}}``` will cause all calls of ```console.log()``` to throw an exception if they're executed during ```require()```.
103+
- *{Array<String>} leaks (optional)*: An array with variable names that should be exported. These variables are accessible via ```myModule.__```
104+
- *{Boolean=true} cache (optional)*: 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.
105105

106106
-----------------------------------------------------------------
107107

0 commit comments

Comments
 (0)