Skip to content

CoverOps is a powerful, cross-platform CLI tool that helps you track test coverage on new or modified code. By combining Git diffs with LCOV or JSON coverage reports, it generates insightful HTML reports that highlight what’s tested — and what’s not.

Notifications You must be signed in to change notification settings

kannel-outis/CoverOps

Repository files navigation

CoverOps 🚀

Spot untested code like a pro with CoverOps — your go-to coverage companion for any project.

CoverOps is a powerful, cross-platform CLI tool that helps you track test coverage on new or modified code. By combining Git diffs with LCOV or JSON coverage reports, it generates insightful HTML, JSON, and console reports that highlight what’s tested — and what’s not. Whether you’re building in Dart, Python, JavaScript, or anything else, CoverOps keeps your code accountable and clean.


Why CoverOps?

  • Track New Code – Pinpoints untested lines in changed or newly added code.
  • 🔎 Cross-language Coverage – Supports any project using Git with LCOV or JSON coverage files.
  • 🌐 Multiple Report Formats – Generates HTML, JSON, and console summaries.
  • Lightweight & Fast – Built with performance in mind.
  • 🧩 Plug & Play – Use it directly or integrate into your CI pipeline.
  • 🛠️ Configurable – Use a JSON config file to simplify complex commands.

📸 What It Looks Like

CoverOps highlights what’s tested — and what’s not — in your changed code.

Screenshot 2025-05-17 at 9 30 28 PM

Screen.Recording.2025-05-16.at.11.23.21.PM.mov

Green = Covered lines in changed code ❌ Red = Missed lines in changed code 📄 Grey = Unchanged or ignored lines

Clear, actionable insights:

  • Track test coverage of only new or modified code.
  • Works across languages (Dart, Python, JS, etc.).
  • Easy-to-read, linkable HTML reports, machine-readable JSON, and quick console summaries.
  • Supports multiple output formats: html, json, console — or even all three at once.
  • Use a JSON config file for easy setup and reuse.

Table of Contents


Quick Start

# Clone the repo
git clone https://github.com/kannel-outis/CoverOps.git
cd CoverOps

# Run coverage analysis
cover report --lcov=coverage/lcov.info --target-branch=main --source-branch=HEAD --output=coverage --report-format=html,console

# Or use a config file
cover report --config=config/coverops.json

# Open the HTML report
open file://$(pwd)/coverage/lcov_html/index.html

What You Need

  • Git: Required to detect changed files.
  • Coverage File: LCOV (lcov.info) or JSON (coverage-final.json) from tools like lcov, coverage.py, or jest.
  • Optional – Dart SDK: Only if you want to run it via dart run. Not required when using platform executables in bin/.

Installation

🔧 Option 1: Use Prebuilt Executable (No Dart Required)

If your bin/ folder already contains the appropriate cover binary for your platform, just run:

./install.sh # or (bash ./install.sh or zsh ./install.sh) to specify shell

This will:

  • Ensure the bin/ folder exists,
  • Add it to your shell’s PATH (e.g., .bashrc, .zshrc, .bash_profile),
  • Let you run cover from anywhere in your terminal.

After that, reload your shell:

source ~/.bashrc   # or ~/.zshrc or ~/.bash_profile

Now you can run:

cover --help # or cover -h

🛠 Option 2: Build Executable (Requires Dart SDK)

Want to build from source? Run:

./install.sh --build

This will:

  • Detect your OS (Linux, macOS, or Windows),
  • Build the cover binary using Dart,
  • Set up your bin/ directory for easy access.

Make sure the Dart SDK is installed and in your PATH. Get it here: https://dart.dev/get-dart


Commands

git

Analyze code changes between branches.

cover git --target-branch=main --source-branch=feature-branch --output-dir=coverage

lcov

Process LCOV or JSON coverage files and match against Git diff data.

cover lcov --lcov=coverage/lcov.info --gitParserFile=coverage/.gitparser.json --output=coverage

report

Runs both git and lcov commands in one go.

cover report --lcov=coverage/lcov.info --target-branch=main --source-branch=feature-branch --output=coverage

You can also pass a config file instead of CLI arguments:

cover report --config=config/coverops.json

Report Types

CoverOps supports multiple report formats, which can be combined with a comma-separated list.

Format Description
html Fully styled, browsable report with annotations
json Structured, CI/CD-ready output
console Human-readable summary printed to stdout

Examples:

# Single format
cover report --report-format=html

# Multiple formats
cover report --report-format=html,console,json

Default format is html if none is specified.


Configuration File Support

You can simplify command-line usage by placing arguments in a config file:

cover report --config=config/coverops.json

Example coverops.json:

{
  "lcov": "coverage/lcov.info"
  "targetBranch": "main"
  "sourceBranch": "HEAD"
  "output": "coverage"
  "reportFormat": ["html","console"]
}

Use this in scripts or CI for consistency and clarity.


Usage Example

For different project types:

Flutter

flutter test --coverage
lcov --remove coverage/lcov.info '*.g.dart' '*.part.dart' -o coverage/lcov.info
cover report --lcov=coverage/lcov.info --target-branch=main --output=coverage --report-format=html,console

Python

pytest --cov=src --cov-report=lcov:coverage/lcov.info
cover report --lcov=coverage/lcov.info --target-branch=main --output=coverage --report-format=html

JavaScript

jest --coverage --coverageReporters=json
cover report --lcov=coverage/coverage-final.json --target-branch=main --output=coverage --report-format=console

Script It Up

Want to automate the workflow? Here's a generic script example for any project type:

#!/bin/bash
# run_coverops.sh

# Optional: Ensure coverage directory is ignored
item="coverage/"
if [ ! -f .gitignore ] || ! grep -q "^$item" .gitignore; then
  echo "$item" >> .gitignore
  echo "Added '$item' to .gitignore"
fi

# Run your own coverage command here
echo "Run your test suite and generate LCOV/JSON coverage..."
# Example: pytest --cov=src --cov-report=lcov:coverage/lcov.info

# Option 1: CLI flags
cover report --lcov=coverage/lcov.info --target-branch=main --source-branch=HEAD --output=coverage --report-format=html,console,json

# Option 2: Config file
# cover report --config=config/coverops.yaml

# Open the HTML report
report_path="coverage/lcov_html/index.html"
if [ -f "$report_path" ]; then
  echo "Coverage report generated at: file://$PWD/$report_path"
  read -p "Open report in browser? (y/n): " choice
  if [[ "$choice" == "y" ]]; then
    open "file://$PWD/$report_path"
  fi
else
  echo "Report not found at $report_path"
fi

Make executable:

chmod +x run_coverops.sh
./run_coverops.sh

Contributing

We welcome contributions of all kinds!

  1. Fork the repo
  2. Create a feature branch
  3. Use Conventional Commits
  4. Test your changes
  5. Submit a pull request

License

CoverOps is licensed under the MIT License.


Get in Touch


CoverOps helps you keep your codebase covered, clean, and deployment-ready. 💪

About

CoverOps is a powerful, cross-platform CLI tool that helps you track test coverage on new or modified code. By combining Git diffs with LCOV or JSON coverage reports, it generates insightful HTML reports that highlight what’s tested — and what’s not.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published