git.infertux.com bashcov / v0.0.5
v0.0.5

Tree @v0.0.5 (Download .tar.gz)

Bashcov Build Status Code Climate

bashcov is simplecov for Bash.

Check out the demo - it's worth a thousand words.

Installation

$ gem install bashcov

Usage

bashcov ./test_suite.sh

This will create a directory named coverage/ containing HTML files.

Rationale

I'm a big fan of both Ruby's simplecov and Bash. bashcov is my dream to have in Bash what simplecov is to Ruby :).

Oddly enough, I didn't find any coverage tool for Bash except shcov but as stated there, shcov is:

somewhat simplistic and doesn't handle all possible cases very well (especially when we're talking about long and complex lines)

Indeed, it doesn't work very well for me. I have covered lines marked as uncovered and some files completely missed although executed through another script.

bashcov aims to be a neat and working coverage tool backed by simplecov and simplecov-html.

How does it work?

Ruby has a coverage module which computes the coverage on demand. Unfortunately, Bash doesn't have such niceties but we can use the xtrace feature which prints every line executed using PS4.

After a bit of parsing, it sends results through simplecov which generates an awesome HTML report.

And of course, you can take the most of simplecov by adding a .simplecov file in your project's root (like this).

Todo

  • semver

License

MIT