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

@cavalierblanc/vitest-anonymized-reporters

v1.0.3

Published

Security-by-design coverage reporters for Vitest with built-in PII anonymization

Readme

CB / @cavalierblanc/vitest-anonymized-reporters

Security-first coverage reporters for Vitest with built-in PII (Personally Identifiable Information) anonymization.

Node.js TypeScript License: MIT

Overview

This library provides drop-in replacements for standard Vitest coverage reporters that automatically strip absolute file paths and other potentially sensitive information from coverage reports.

Key Benefits

  • Privacy by Design: Automatic PII protection in all coverage artifacts
  • GDPR/CCPA Compliant: Meets data privacy requirements for test reporting
  • Zero Configuration: Works out-of-the-box with sensible security defaults
  • Seamless Integration: Compatible with existing Vitest workflows

Features

  • Anonymized JSON Reporter: Produces Istanbul-compatible JSON coverage with sanitized paths
  • Anonymized LCOV Reporter: Generates LCOV format with absolute paths removed
  • Anonymized Clover Reporter: Post-processes Clover XML output to strip absolute paths
  • Path Anonymization: Converts absolute paths to relative paths from project root
  • Security Logging: Clear indicators when anonymization is applied
  • TypeScript Support: Full type definitions included
  • Vitest 4.x Compatible: Tested with Vitest ^4.0.0

Reporter Types

This library provides two types of reporters:

  • Standalone reporters (json-anonymizer, lcov-anonymizer): Generate coverage output directly via Istanbul hooks. They replace the standard json and lcov reporters entirely.
  • Post-processing reporter (clover-anonymizer): Reads and anonymizes a pre-existing clover.xml file. The standard 'clover' reporter must be listed before the anonymizer in the reporter array.

Installation

Install the Package

npm install --save-dev @cavalierblanc/vitest-anonymized-reporters

Peer Dependencies

This package requires Vitest and the V8 coverage provider:

npm install --save-dev vitest@^4.0.0 @vitest/coverage-v8@^4.0.0

Usage

Configure the reporters in your vitest.config.ts under test.coverage.reporter:

export default defineConfig({
  test: {
    coverage: {
      enabled: true,
      provider: 'v8',
      reporter: [
        'text',
        ['html', { subdir: 'coverage' }],
        // Clover: standard reporter MUST precede the anonymizer
        'clover',
        ['@cavalierblanc/vitest-anonymized-reporters/reporters/clover-anonymizer', {}],
        // LCOV and JSON: standalone anonymized reporters (no upstream required)
        ['@cavalierblanc/vitest-anonymized-reporters/reporters/lcov-anonymizer', {}],
        ['@cavalierblanc/vitest-anonymized-reporters/reporters/json-anonymizer', {}],
      ],
      reportsDirectory: 'data/reports/test/unit',
    },
  },
});

Important: Clover Reporter Ordering

The clover-anonymizer is a post-processor — it reads the clover.xml generated by Istanbul's built-in 'clover' reporter and rewrites all file paths to relative paths. If the standard 'clover' reporter is omitted, no clover.xml file will exist and the anonymizer will silently skip processing.

The lcov-anonymizer and json-anonymizer reporters are standalone — they hook into Istanbul's coverage tree directly and produce anonymized output without requiring an upstream reporter.

Output Files

When configured as shown above, the following anonymized files are generated in reportsDirectory:

| Reporter | Default Output File | Description | |----------------------|------------------------|-----------------------------------------------| | clover-anonymizer | clover.xml | Anonymized Clover XML (overwrites in-place) | | lcov-anonymizer | lcov.info | Anonymized LCOV info | | json-anonymizer | coverage-final.json | Anonymized JSON coverage |

All output filenames can be customized via the file option in each reporter's configuration.

Requirements

  • Node.js >= 24.5.0
  • npm >= 11.5.0

License

MIT © 2026 Cavalier Blanc Inc.