npm.io
1.0.1 • Published 2 weeks ago

@vitest/istanbul-lib-coverage

Licence
MIT
Version
1.0.1
Deps
0
Size
23 kB
Vulns
0
Weekly
0
Stars
6

@vitest/istanbul-lib-coverage

Build Status

An API that provides a read-only view of coverage information with the ability to merge and summarize coverage info.

Supersedes object-utils and collector from the v0 istanbul API.

See the docs for the full API.

import * as libCoverage from "@vitest/istanbul-lib-coverage";

const map = libCoverage.createCoverageMap(globalCoverageVar);
const summary = libCoverage.createCoverageSummary();

// merge another coverage map into the one we created
map.merge(otherCoverageMap);

// inspect and summarize all file coverage objects in the map
for (const f of map.files()) {
  const fc = map.fileCoverageFor(f);
  summary.merge(fc.toSummary());
}

console.log("Global summary", summary);

Keywords