node.js - When use istanbul, is there any way to dynamic require config.js? -
the logenable
write in config.js
, there way change value during testing? can improve branch coverage.
you ignore parts of code testing: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md
skip if or else path
/* istanbul ignore if */
or/* istanbul ignore else */
respectively.for other cases, skip next 'thing' in source with:
/* istanbul ignore next */
or add single test checks logging functions both logging enabled , disabled (you can override required modules, config, example proxyquire: https://github.com/thlorenz/proxyquire).