Skip to content

Commit c3220fd

Browse files
committed
document __mocks__
1 parent c25d77c commit c3220fd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ I have wrote some articles about these ideas - https://medium.com/tag/rewiremock
7171
## helper functions
7272
- rewuremock.stubFactory(factory) - define a stub factory for mockThrough command.
7373

74+
### Automocking
75+
Rewiremock supports (inspired by [Jest](https://facebook.github.io/jest/docs/en/manual-mocks.html)) auto `__mocks__`ing.
76+
Just create `__mocks__/fileName.js`, and `fileName.js` will be replaced by mock. Please refer to Jest documentation for use cases.
77+
78+
If you dont want some file to be replaced by mock - add it, and then - disable
79+
```js
80+
rewiremock('fileName.js').disable();
81+
```
82+
7483
# Which one?
7584
Yep - there is 4 top level ways to activate a mock - inScope, around, proxy or just enable.
7685

0 commit comments

Comments
 (0)