Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/infertux/bashcov

Code coverage tool for Bash
https://github.com/infertux/bashcov

bash code-coverage coverage coverage-report ruby rubygems shell simplecov tdd testing

Last synced: 6 days ago
JSON representation

Code coverage tool for Bash

Awesome Lists containing this project

README

        

# Bashcov

[![Funding](https://img.shields.io/liberapay/patrons/infertux.svg?logo=liberapay)](https://liberapay.com/infertux/donate)
[![Gem Version](https://img.shields.io/gem/v/bashcov.svg)](https://rubygems.org/gems/bashcov)
[![Build Status](https://gitlab.com/infertux/bashcov/badges/master/pipeline.svg)](https://gitlab.com/infertux/bashcov/-/pipelines)
[![Maintainability](https://api.codeclimate.com/v1/badges/083fdbba795049cd5f06/maintainability)](https://codeclimate.com/github/infertux/bashcov/maintainability)
[![Inline docs](http://inch-ci.org/github/infertux/bashcov.svg)](http://inch-ci.org/github/infertux/bashcov)

Bashcov is a **code coverage analysis tool for Bash**.

In most cases, you'll want overall coverage results for your project from
[shUnit2](https://github.com/kward/shunit2),
[Bats](https://github.com/bats-core/bats-core),
[bash_unit](https://github.com/pgrange/bash_unit),
[assert.sh](https://github.com/lehmannro/assert.sh),
[bashaspec](https://github.com/d10n/bashaspec),
etc.
Bashcov automatically takes care of this by caching and merging results when generating reports,
so your report includes coverage across your test suites and thereby gives you a better picture of blank spots.

It uses the [SimpleCov](https://github.com/colszowka/simplecov) coverage library to generate HTML reports.
SimpleCov gets installed automatically when you install Bashcov.

Here are example coverages generated by Bashcov:
[test app demo](https://infertux.github.io/bashcov/test_app/ "Coverage for the bundled test application") &
[RVM demo](https://infertux.github.io/bashcov/rvm/ "Coverage for RVM").

## Installation

`gem install bashcov`

If the `gem` command is unavailable, you need to [install Ruby](https://www.ruby-lang.org/en/documentation/installation/) first.

For more information, including other installation methods, see [`INSTALL.md`](./INSTALL.md).

## Usage

`bashcov --help` prints all available options. Here are some examples:

bashcov ./script.sh
bashcov --skip-uncovered ./script.sh
bashcov -- ./script.sh --some --flags
bashcov --skip-uncovered -- ./script.sh --some --flags

`./script.sh` can be a mere Bash script or typically your CI script. Bashcov will keep track of all executed scripts.

It will create a directory named `./coverage/`, you may open `./coverage/index.html` to browse the coverage report.

### SimpleCov integration

You can leverage the underlying library [SimpleCov](https://github.com/colszowka/simplecov)
by adding a `.simplecov` file in your project's root, like [this](https://github.com/infertux/bashcov/blob/master/spec/test_app/.simplecov).
See [advanced usage](./USAGE.md) for more information.

## Contributing

Bug reports and patches are most welcome.
See the [contribution guidelines](https://github.com/infertux/bashcov/blob/master/CONTRIBUTING.md).

For development tips, see [the hacking guide](./HACKING.md).

## Sponsorship

Bashcov was [created in 2012](https://github.com/infertux/bashcov/commit/f65e65e5aa3377beb334beee9924136a34a913e8) and it needs your help. I have been maintaining the project for over a decade and keeping it working with new releases of Bash and Ruby takes time. If you use Bashcov professionally, please considerer supporting it on [Liberapay](https://liberapay.com/infertux) through your employer or directly. Thank you for supporting *Free and Open-Source Software*.

## License

MIT