0

enter image description here

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.

Jaimesh
  • 841
  • 4
  • 25
  • 41
keenwon
  • 99
  • 1
  • 5

1 Answers1

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