2.1.0 • Published 2 months ago

istanbul-to-vscode v2.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

istanbul-to-vscode

A utility library that converts Istanbul coverage reports to the format expected by VS Code's test coverage API.

Usage

In simple cases, you can just read the Istanbul report and create the coverage provider that we export:

import { IstanbulCoverageContext } from 'istanbul-to-vscode';

export const coverageContext = new IstanbulCoverageContext();

function activate() {
  // ...

  testRunProfile.loadDetailedCoverage = coverageContext.loadDetailedCoverage;
}

async function runTests() {
  // ...

  await coverageContext.apply(testRun, coverageDir);
}

But often you may want to apply sourcemap mappings. To do that, you can provide additional options either in apply() or when creating the CoverageContext:

async function runTests() {
  // ...

  await coverageContext.apply(task, coverageDir, {
    mapFileUri: (uri) => sourceMapStore.mapUri(uri),
    mapPosition: (uri, position) => sourceMapStore.mapLocation(uri, position),
  });
}
2.1.0

2 months ago

2.0.1

2 months ago

2.0.0

2 months ago

1.0.1

3 months ago

1.0.0

3 months ago