# lcov-badge2

> Generate a badge from a LCOV report

Latest version **1.1.4** (published 2026-03-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install lcov-badge2
pnpm add lcov-badge2
yarn add lcov-badge2
bun add lcov-badge2
```

Provides the command `lcov-badge2`.

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2026-03-04 |
| First published | 2021-05-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16 |
| Dependencies | 4 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Steve Hair |
| Maintainers | stevenhair |
| Keywords | lcov, badge, coverage, test |

## Links

- npm: https://www.npmjs.com/package/lcov-badge2
- Repository: https://github.com/stevenhair/lcov-badge2
- Homepage: https://github.com/stevenhair/lcov-badge2#readme
- Issues: https://github.com/stevenhair/lcov-badge2/issues
- npm.io page: https://npm.io/package/lcov-badge2

## Dependencies (4)

- [minimist](https://npm.io/package/minimist.md) ^1.2.5
- [badge-up2](https://npm.io/package/badge-up2.md) ^2.0.1
- [parse-lcov](https://npm.io/package/parse-lcov.md) ^1.0.4
- [minimist-options](https://npm.io/package/minimist-options.md) ^4.1.0

## 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.1.4 (latest) — 2026-03-04
- 1.1.3 — 2026-01-21
- 1.1.2 — 2023-10-15
- 1.1.1 — 2023-10-02
- 1.1.0 — 2023-09-29
- 1.0.3 — 2021-12-10
- 1.0.2 — 2021-05-06
- 1.0.0 — 2021-05-01

## README

# lcov-badge2

A tool for generating SVG badges from LCOV reports, based on [lcov-badge](https://github.com/freejosh/lcov-badge)

[![Build](https://github.com/stevenhair/lcov-badge2/actions/workflows/test.yml/badge.svg)](https://github.com/stevenhair/lcov-badge2/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/stevenhair/lcov-badge2/branch/master/graph/badge.svg?token=nb0yy1Y6zc)](https://codecov.io/gh/stevenhair/lcov-badge2)
[![npm](https://img.shields.io/npm/v/lcov-badge2.svg?maxAge=2592000)](https://www.npmjs.com/package/lcov-badge2)
[![downloads](https://img.shields.io/npm/dt/lcov-badge2.svg?maxAge=2592000)](https://www.npmjs.com/package/lcov-badge2)

## Usage

lcov-badge2 can be used as either a command line utility or a library.
It produces your basic build badge:

![example](https://raw.githubusercontent.com/stevenhair/lcov-badge2/master/example.svg)

### Command line usage

To use this library, just pass the path to your lcov file:

```bash
lcov-badge2 coverage/lcov.info
```

This will generate a `badge.svg` file. If you want an output file with a different name, you can pass
the `-o` option:

```bash
lcov-badge2 -o coverage.svg coverage/lcov.info
```

You can view all arguments by passing the `-h` option.

### Library usage

Here's an example of programmatic usage:

```typescript
import generateBadge from 'lcov-badge2';

const badge = generateBadge('coverage/lcov.info', 'coverage')
fs.writeFileSync('badge.svg', badge);
```

---
_Source: https://npm.io/package/lcov-badge2 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
