doc: clarify mocks documentation

This commit is contained in:
Xymorot 2019-11-22 21:31:10 +01:00
parent 2006815b2b
commit 7c2aaacf13
1 changed files with 6 additions and 2 deletions

View File

@ -59,8 +59,12 @@ The testing framework of choice is [Mocha](https://mochajs.org/). Call `npm run
There are 2 ways in which mocks are defined/used:
0. for external modules, in [mocks](mocks), uses the [rewiremock](https://github.com/theKashey/rewiremock) package; use this only when there is some magic happening like for electron which normally runs in its own node process
1. for own modules, just beside their test file in [tests](tests); name the file `*.mock.ts` and use other files for orientation; use sparingly and only when not having a mock makes it more complex e.g. for modules which interact with the file system
0. for external modules, in [mocks](mocks)
- uses the [rewiremock](https://github.com/theKashey/rewiremock) package
- use this only when there is some magic happening like for electron which normally runs in its own node process
1. for own modules, just beside their test file in [tests](tests)
- name the file `*.mock.ts` and use existing mock files for orientation on how to build them
- use sparingly and only when not having a mock makes it more complex e.g. for modules which interact with the file system
#### Tagging