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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@cats-cradle/rush-coverage

v1.2.11

Published

[![npm version](https://badge.fury.io/js/@cats-cradle%2Frush-coverage.svg)](https://badge.fury.io/js/@cats-cradle%2Frush-coverage) [![License](https://img.shields.io/badge/License-MIT-brightgreen.svg)](LICENSE) [![GitHub Stars](https://img.shields.io/gith

Downloads

17

Readme

@cats-cradle/rush-coverage

npm version License GitHub Stars

RushCoverage is a code coverage consolidation tool for RushJs based monorepos.

It consolidates code coverage reports from multiple projects into one report. This allows for one coverage badge to cover the entire monorepo or one badge to coverage each team, etc. as to help promote team ownership of code base.

This can be useful for continuous integration purposes. It can also be useful for simultaneously browsing coverage html, et al. reports for the entire repo.

Usage

Beforehand, use Jest (or similar) to generate **/**/coverage/coverage-final.json coverage reports for each project.

Now that it's ready, run the script to merge coverage files from all projects into a single report:

npx @cats-cradle/[email protected]

Note Make sure the version of @microsoft/rush-lib specified in rush.json matches the dependencies specified in this package.

That's it! The consolidated code coverage reports are generated to cwd ./coverage. Reports can reviewed manually or integrated into CI.

Github Action

This is an example of how to use a Github Action, RushCoverage, and third party -- in this case Codacy -- to generate code coverage in CI.

See vendor specific documentation for instructions on coverage submission, badging, pr feedback, etc.

name: CodeCoverage

on:
  workflow_call:
    secrets:
      CODACY_PROJECT_TOKEN:
        required: true

jobs:
  rush-coverage:
    name: rush coverage
    timeout-minutes: 15
    runs-on: ubuntu-latest
    steps:
      - name: checkout repository
        uses: actions/checkout@v3

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: '18.12.0'

      - name: Rush install
        run: node common/scripts/install-run-rush.js install

      - name: Rush build
        run: node common/scripts/install-run-rush.js build

      - name: Rush test with coverage
        run: node common/scripts/install-run-rush.js test:cov

      - name: Merge coverage reports
        run: npx @cats-cradle/[email protected]

      - name: Submit merged coverage report
        uses: codacy/[email protected]
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: coverage/lcov.info

Note Change test:cov command as specific to your monorepo setup. Set secrets, in this case CODACY_PROJECT_TOKEN, as necessary in Github.

How it Works

RushCoverage works by obtaining a list of all projects from rush.json. Then gather a list of all coverage files from each project with a compatible ./coverage/coverage-final.json . It then combines all the coverage files found into one consolidated coverage report.