In my React component I have some no-op functions, which basically is just placeholders for a functions. I have Istanbul test coverage, and it's complain on no-op function coverage:
Is there any ways to cover it?
To make Instanbul ignore noop functions we can use /* istanbul ignore next */
mentioned here.
For you example coverage, you could do something like
const defaultContext = {
activeInput: null,
removeFocus: /* istanbul ignore next */ () => {},
focusInput: /* istanbul ignore next */ () => {},
}
Or you could define an isolated noop function and reuse whenever needs
/* istanbul ignore next */
function noop() {}
const defaultContext = {
activeInput: null,
removeFocus: noop,
focusInput: noop,
}