test_badge_gen 0.0.2 copy "test_badge_gen: ^0.0.2" to clipboard
test_badge_gen: ^0.0.2 copied to clipboard

cli help generate test badge coverage svg support customize the input and output file path for generated badges.

test_badge_gen #

pub package Coverage

**Test Badge Coverage ** is a simple command-line tool for generating test coverage badges in SVG format from an lcov.info file. #

Features #

  • Generate test coverage badges based on lcov.info files.
  • Customize the output file path for generated badges.
  • Built with Dart for speed and reliability.
  • Provides helpful console output and guidance.

Installation #

  1. Active test_badge_gen package :
    • Flutter:
      flutter pub global activate test_badge_gen
    
    • Or with Dart:
      dart pub global activate test_badge_gen
    
  2. Ensure that the CLI executable is globally available. Add the Dart bin folder to your PATH:
      export PATH="$PATH":"$HOME/.pub-cache/bin"
    
  3. Verify the installation:
      badge-test --help
    

Usage #

The badge-test CLI provides commands for generating test coverage badges. Below are usage instructions with examples.

Command: gen

The gen command generates a badge from the specified lcov.info file.

Syntax:

  badge-test gen --in=<path_to_lcov.info> --out=<output_path>

Options:

Option Description Required Default
--in= The input path to the lcov.info file. Yes None
--out= The output path for the generated badge. If not specified, defaults to coverage_badge.svg. No coverage_badge.svg

Example:

  1. Basic Usage:

    badge-test gen --in=lcov.info
    

    This generates a badge file named coverage_badge.svg in the current directory.

  2. Custom Output Path:

    badge-test gen --in=lcov.info --out=badges/test_coverage.svg
    

    This generates a badge file at the specified output path. Coverage

  3. Error Handling: If the input file is missing or invalid, the command will prompt an error message:

    Generator failed! Please input lcov.info file path.
    

Additional information #

To show in README #

Add

![Coverage](https://raw.githubusercontent.com/{you}/{repo}/master/{yourSVGFile}.svg?sanitize=true)

Running the CLI Locally #

Clone the repository:

git clone https://github.com/MinhMark123123/m_cli.git
cd m_cli/test_badge_gen

Activate the CLI locally:

dart pub global activate --source path .

Run :

badge-test gen --in=lcov.info

Running Tests ๐Ÿงช #

To run all unit tests:

dart pub global activate coverage
dart test --coverage=coverage
dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info

To view the generated coverage report you can use lcov.

# Generate Coverage Report
genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
open coverage/index.html

To Generate badge image

badge-test gen --in=coverage/lcov.info
1
likes
150
points
1.91k
downloads

Publisher

unverified uploader

Weekly Downloads

cli help generate test badge coverage svg support customize the input and output file path for generated badges.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

args, m_cli_core

More

Packages that depend on test_badge_gen