Project

bashcov

0.08
A long-lived project that still receives updates
Code coverage tool for Bash
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.22.0
 Project Readme

Bashcov

Funding Gem Version Build Status Maintainability Inline docs

Bashcov is a code coverage analysis tool for Bash.

In most cases, you'll want overall coverage results for your project from shUnit2, Bats, bash_unit, assert.sh, 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 coverage library to generate HTML reports. SimpleCov gets installed automatically when you install Bashcov.

Here are example coverages generated by Bashcov: test app demo & RVM demo.

Installation

gem install bashcov

If the gem command is unavailable, you need to install Ruby first.

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 by adding a .simplecov file in your project's root, like this. See advanced usage for more information.

Contributing

Bug reports and patches are most welcome. See the contribution guidelines.

Sponsorship

Bashcov was created in 2012 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 through your employer or directly. Thank you for supporting Free and Open-Source Software.

License

MIT