Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/connor4312/istanbul-to-vscode
Converts Istanbul coverage output to VS Code's coverage API
https://github.com/connor4312/istanbul-to-vscode
Last synced: 3 months ago
JSON representation
Converts Istanbul coverage output to VS Code's coverage API
- Host: GitHub
- URL: https://github.com/connor4312/istanbul-to-vscode
- Owner: connor4312
- License: mit
- Created: 2024-02-07T17:35:23.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-28T01:43:36.000Z (9 months ago)
- Last Synced: 2024-10-06T12:37:46.719Z (3 months ago)
- Language: TypeScript
- Size: 25.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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:
```ts
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`:
```ts
async function runTests() {
// ...await coverageContext.apply(task, coverageDir, {
mapFileUri: (uri) => sourceMapStore.mapUri(uri),
mapPosition: (uri, position) => sourceMapStore.mapLocation(uri, position),
});
}
```