How to use the istanbul-lib-coverage/lib/coverage-map.CoverageMap function in istanbul-lib-coverage

To help you get started, we’ve selected a few istanbul-lib-coverage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Eywek / v8-coverage / src / report.js View on Github external
mergeReport (map, report) {
    debug('Merge 1 report to map')
    let sourceMap
    if (report instanceof CoverageMap) {
      sourceMap = report
    } else {
      sourceMap = new CoverageMap(report)
    }
    Object.keys(sourceMap.data).forEach((k) => {
      let fc = sourceMap.data[k]
      if (map.data[k]) {
        this.mergeReportData(map.data[k], fc)
      } else {
        map.data[k] = fc
      }
    })
  }