# @vitest/istanbul-lib-report

> Base reporting library and report generators for istanbul

Latest version **1.0.1** (published 2026-08-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vitest/istanbul-lib-report
pnpm add @vitest/istanbul-lib-report
yarn add @vitest/istanbul-lib-report
bun add @vitest/istanbul-lib-report
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-08-31 |
| First published | 2026-08-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=22 |
| Dependencies | 1 |
| Unpacked size | 151.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 6 |
| Author | Vitest Team |
| Maintainers | ariperkkio, antfu, hiogawa, oreanno, yyx990803 |
| Keywords | api, istanbul, lib, report, reports, vitest |

## Links

- npm: https://www.npmjs.com/package/@vitest/istanbul-lib-report
- Repository: https://github.com/vitest-dev/istanbuljs
- Homepage: https://vitest.dev
- Issues: https://github.com/vitest-dev/vitest/issues
- npm.io page: https://npm.io/package/@vitest/istanbul-lib-report

## Dependencies (1)

- [@vitest/istanbul-lib-coverage](https://npm.io/package/@vitest/istanbul-lib-coverage.md) 1.0.1

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2026-08-31
- 1.0.0 — 2026-08-25
- 0.0.4 — 2026-08-25
- 0.0.3 — 2026-08-24
- 0.0.2 — 2026-08-24
- 0.0.1 — 2026-08-24

## README

# @vitest/istanbul-lib-report

Core reporting utilities and report generators for istanbul. This package contains both the
reporting context (formerly `istanbul-lib-report`) and the built-in reports
(formerly `istanbul-reports`).

## Example usage

```js
import * as libReport from "@vitest/istanbul-lib-report";

// coverageMap, for instance, obtained from @vitest/istanbul-lib-coverage
const coverageMap;

const configWatermarks = {
  statements: [50, 80],
  functions: [50, 80],
  branches: [50, 80],
  lines: [50, 80],
};

// create a context for report generation
const context = libReport.createContext({
  dir: "report/output/dir",
  // The summarizer to default to (may be overridden by some reports)
  // values can be nested/flat/pkg. Defaults to 'pkg'
  defaultSummarizer: "nested",
  watermarks: configWatermarks,
  coverageMap,
});

// create an instance of the relevant report class, passing the
// report name e.g. json/html/html-spa/text
const report = libReport.create("json", {
  skipEmpty: configSkipEmpty,
  skipFull: configSkipFull,
});

// call execute to synchronously create and write the report to disk
report.execute(context);
```

### Custom reporters

`create()` only knows the built-in reporters. To load a custom reporter use `createAsync()`, which accepts a built-in name, a package name, an absolute path or a `file://` URL.
The module's default export (ESM) or `module.exports` (CommonJS) must be the report class:

```js
import { createAsync, ReportBase } from "@vitest/istanbul-lib-report";

// my-report.mjs
export default class MyReport extends ReportBase {
  onStart(root, context) {
    this.writer = context.writer.writeFile("my-report.txt");
  }
  onEnd() {
    this.writer.close();
  }
}

const report = await createAsync("/absolute/path/to/my-report.mjs", {
  summarizer: "nested",
});
report.execute(context);
```

---
_Source: https://npm.io/package/@vitest/istanbul-lib-report · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
