答案 0 :(得分:0)
要使Instanbul忽略noop函数,我们可以使用here中提到的/* istanbul ignore next */
。
例如,您可以做类似的事情
const defaultContext = {
activeInput: null,
removeFocus: /* istanbul ignore next */ () => {},
focusInput: /* istanbul ignore next */ () => {},
}
或者您可以定义一个隔离的noop函数并在需要时重用
/* istanbul ignore next */
function noop() {}
const defaultContext = {
activeInput: null,
removeFocus: noop,
focusInput: noop,
}