The logEnable
is write in config.js
, is there any way to change the value during testing? So than I can improve the branch coverage.
Asked
Active
Viewed 183 times
1 Answers
1
You could ignore parts of code from testing: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
Skip an if or else path with
/* istanbul ignore if */
or/* istanbul ignore else */
respectively.For all other cases, skip the next 'thing' in the source with:
/* istanbul ignore next */
Or add a single test that checks just those logging functions with both logging enabled and disabled (you can override required modules, like your config, for example with proxyquire: https://github.com/thlorenz/proxyquire).

ahwayakchih
- 2,101
- 19
- 24