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

@continuit/testreport

v0.1.3

Published

Generates a test report and badges from your test and coverage results. Allows checking the report in your CI pipeline.

Readme

testreport

JSR NPM ci test coverage License: MIT

This utility creates a test report from a JUnit XML file and a LCOV file or checks if a test report is up to date with the current test results.

It has two modes of operation:

  • Create a test report and badges from a JUnit XML file and a LCOV file.
  • Check if a previous test report is up to date with the current test results.

This utility can be used to create the test report inside your repository. The report can be referenced from the README.md file and the generated badges can be used to show the test results on the repository page.

The second mode can be used to check if a previous test report is up to date with the current test results. This can be used to ensure that the test report is updated with the current test results, for example when running tests on a CI server.

Usage

| Platform | Command | | -------- | ------------------------------------ | | npm | npm install @continuit/testreport | | deno | deno add jsr:@continuit/testreport |

For other platforms see jsr.io for more information.

Basic usage

Create a test report definition file, for example testreport.json:

{
  "$schema": "https://raw.githubusercontent.com/ContinuIT-nl/testreport/refs/heads/main/configSchema/testReportConfigSchema.json",
  "input": {
    "junit": ["test_results/junit.xml"],
    "coverage": ["test_results/cov.lcov"]
  },
  "limits": {
    "test_percentage_failed": 0,
    "test_percentage_disabled": 0,
    "coverage_percentage_minimal": 80
  },
  "manifest": {
    "output": "test_results/test_results.json"
  },
  "markdown": {
    "output": "test_results/test_results.md"
  },
  "testBadge": {
    "output": "test_results/test_badge.svg",
    "label": "tests",
    "style": "flat",
    "color_ok": "#2EBE4E",
    "color_none": "#888800",
    "color_disabled": "#888800",
    "color_failed": "#990000"
  },
  "coverageBadge": {
    "output": "test_results/coverage_badge.svg",
    "label": "coverage",
    "style": "flat",
    "levels": [
      { "threshold": 99, "color": "#2EBE4E" },
      { "threshold": 90, "color": "#888800" },
      { "threshold": 0, "color": "#990000" }
    ]
  }
}

input

| Key | Type | Description | | ---------- | -------- | -------------------------------------------------- | | junit | string[] | The JUnit XML files to include in the test report. | | coverage | string[] | The LCOV files to include in the test report. |

limits

| Key | Type | Description | Default Value | | ----------------------------- | ------ | ------------------------------------------------- | ------------- | | test_percentage_failed | number | The percentage of failed tests that is allowed. | 0 | | test_percentage_disabled | number | The percentage of disabled tests that is allowed. | 0 | | coverage_percentage_minimal | number | The minimum coverage percentage that is required. | 0 |

manifest

| Key | Type | Description | | -------- | ------ | ---------------------------------------- | | output | string | The path to the manifest file to create. |

markdown

| Key | Type | Description | Default Value | | ----------------- | ------- | ---------------------------------------- | ------------- | | output | string | The path to the markdown file to create. | | | badges | boolean | Whether to create badges. | true | | collapseDetails | boolean | Whether to collapse the details. | false |

testBadge

| Key | Type | Description | Default Value | | ---------------- | ------ | -------------------------------------------------------- | ------------- | | output | string | The path to the test badge file to create. | | | label | string | The label of the test badge. | "tests" | | style | string | The style of the test badge. | "flat" | | color_label | string | The color of the test badge label. | "#555" | | color_ok | string | The color of the test badge when the tests pass. | "#2EBE4E" | | color_none | string | The color of the test badge when no tests are run. | "#888800" | | color_disabled | string | The color of the test badge when the tests are disabled. | "#888800" | | color_failed | string | The color of the test badge when the tests fail. | "#990000" |

coverageBadge

| Key | Type | Description | Default Value | | ------------- | ------ | ---------------------------------------------- | ------------- | | output | string | The path to the coverage badge file to create. | | | label | string | The label of the coverage badge. | "coverage" | | style | string | The style of the coverage badge. | "flat" | | color_label | string | The color of the coverage badge label. | "#555" | | levels | array | The levels of the coverage badge. | |

levels

| Key | Type | Description | Default Value | | ----------- | ------ | ------------------------------------ | ------------- | | threshold | number | The threshold of the coverage badge. | 80 | | color | string | The color of the coverage badge. | "#2EBE4E" |

All output files are optional. If you want to perform the --check command, you need to provide at least the manifest file.

Run the testreport utility:

deno run -RW jsr:@continuit/testreport testreport.json

or if you use npm:

testreport testreport.json

In the above example the test report will be created in the testresults folder. Normally you would reference the test report from the README.md file and the badges from the repository page. The folder testdata with the JUnit XML file and the LCOV file should not be checked into the repository. In your CI pipeline you can run the testreport utility and check if the test report is up to date with the current test results.

testreport --check testreport.json

This will check if the test report is up to date with the current test results. If the test report is not up to date, the utility will exit with a non-zero exit code.

Setup

As long as JUnit XML and LCOV files are generated, the test report can be created.

Deno

Run your tests to generate the JUnit XML file and the coverage folder. Then convert the coverage folder to a LCOV file.

deno test --coverage --clean --junit-path test_results/junit.xml
deno coverage --lcov --output=test_results/cov.lcov

Jest

Make sure Jest and Jest-junit are installed:

npm install --save-dev jest jest-junit

Run your tests to with code coverage enabled.

jest --coverage

And in your jest.config.js configuration file add the following:

module.exports = {
  ...,
  reporters: [
    'default',
    ['jest-junit', {outputDirectory: 'outputFolder', outputName: 'junit.xml'}],
  ]
}

Vitest

Make sure Vitest and a coverage library is installed:

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

An example of a minimal vitest.config.ts:

import { defineConfig } from 'vitest/config';

export default defineConfig({
  test: {
    coverage: {
      enabled: true,
      provider: 'v8',
      reporter: ['lcov'],
    },
    environment: 'node',
    globals: true,
    include: [...],
    exclude: [...],
    reporters: ['junit'],
    outputFile: 'test-results.xml',
  },
});

Code quality

The code quality is measured using unit tests and code coverage. See the Test report for more information.

License

This project is licensed under the MIT license. See the LICENSE file for details.