npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

test-coverage-merger

v1.0.1

Published

A package providing capability to merge test coverage reports.

Readme

Test Coverage Merger

Test Coverage Merger is a powerful tool designed to merge multiple LCOV reports generated by test runners and produce a consolidated HTML report. This tool is ideal for aggregating code coverage data from various test suites into a single, easy-to-read format. More details for lcov

Features

  • Merge LCOV Reports: Combine multiple LCOV reports into a single report.
  • Generate HTML Reports: Create a detailed HTML report from the merged LCOV data.
  • Comprehensive Coverage Statistics: Provides detailed statistics for lines, branches, functions, and statements.

Installation

To use Test Coverage Merger in your project, ensure you have Node.js and npm installed. Then, install the package via npm:

npm install test-coverage-merger

Usage

Programmatic API

  1. Using testCoverageMerger This is the main function to merge LCOV reports and generate an HTML report.
import { testCoverageMerger } from 'test-coverage-merger';

const coverageReports = [
  'path/to/report1-lcov.info',
  'path/to/report2-lcov.info',
];
const rootPath = 'test-reports';
const mergedLcovFileName = 'merged-report';
const outputHtmlFileName = 'final-report';

testCoverageMerger({
  rootPath,
  mergedLcovFileName,
  outputHtmlFileName,
  coverageReports,
});

Parameters

  • rootPath: The directory where the merged LCOV file and HTML report will be saved. Default is 'test-reports'.
  • mergedLcovFileName: The name of the merged LCOV file. Default is 'merged-report'.
  • outputHtmlFileName: The name of the output HTML report file. Default is 'final-report'.
  • coverageReports: An array of paths to the LCOV report files to be merged.
  1. Independent Use of Modules

mergeLcovReports This function merges multiple LCOV files into a single file.

import { mergeLcovReports } from 'test-coverage-merger/merge-lcov-reports';

const reports = ['path/to/report1.lcov', 'path/to/report2.lcov'];
const outputPath = 'path/to/merged-report.lcov';

mergeLcovReports(reports, outputPath);

lcovFileParser This function parses an LCOV file and returns structured data.

import { lcovFileParser } from 'test-coverage-merger/lcov-file-parser';

const lcovData = `TN:
SF:file1.ts
DA:1,1
DA:2,0
end_of_record`;

lcovFileParser(lcovData, (err, parsedData) => {
  if (err) {
    console.error('Error parsing LCOV data:', err);
  } else {
    console.log('Parsed LCOV data:', parsedData);
  }
});

htmlReportGenerator This function generates an HTML report from parsed LCOV data.

import { htmlReportGenerator } from 'test-coverage-merger/html-report-generator';

const parsedData = [
  {
    file: 'file1.ts',
    lines: { found: 2, hit: 1 },
    branches: { found: 0, hit: 0 },
    functions: { found: 0, hit: 0 },
    statements: { found: 2, hit: 1 },
  },
];

const coverageReports = ['path/to/report1.lcov', 'path/to/report2.lcov'];
const htmlReport = htmlReportGenerator(parsedData, coverageReports);
console.log(htmlReport);