function modifyBabelLoaderRuleForTest (rules) {
  return modifyBabelLoaderRules(rules, rule => {
    if (rule.options && rule.options.plugins) {
      rule.options.plugins.push('istanbul')
    }
    return rule
  })
}
Adds instrumentation plugin for code coverage in test mode.

@param {import('webpack').RuleSetRule[]} rules
@returns {import('webpack').RuleSetRule[]}