Use the 'cov-loupe' application as a command line utility.¶
The cov-loupe application provides precise test coverage information for your Ruby application.
It reads the .resultset.json file generated by SimpleCov, and offers multiple ways to analyze and display its information.
Below is the help for version 4.0.0.pre, but run cov-loupe --help to make sure you get the most up-to-date information.
-------------------------------------------------------------------------------
Usage: cov-loupe [options] [subcommand] [args] (default subcommand: list)
Repository: https://github.com/keithrbennett/cov-loupe
Documentation (Web): https://keithrbennett.github.io/cov-loupe/
Documentation (Local): /home/kbennett/code/cov-loupe/**/*.md
Version: 4.0.0.pre
-------------------------------------------------------------------------------
Subcommands:
detailed <path> Show per-line rows with hits/covered
list Show files coverage (default: table, or use --format)
raw <path> Show the SimpleCov 'lines' array
summary <path> Show covered/total/% for a file
totals Show aggregated line totals and average %
uncovered <path> Show uncovered lines and a summary
validate <file> Evaluate coverage policy from file (exit 0=pass, 1=fail, 2=error)
validate -i <code> Evaluate coverage policy from code string
version Show version information
Options:
-r, --resultset PATH Path or directory that contains .resultset.json (default: coverage/.resultset.json)
-R, --root PATH Project root (default: .)
-f, --format FORMAT Output format: t[able]|j[son]|pretty-json|y[aml]|a[wesome-print] (default: table)
-o, --sort-order ORDER Sort order for list: a[scending]|d[escending] (default descending)
-s, --source MODE Source display: f[ull]|u[ncovered]
-c, --context-lines N Context lines around uncovered lines (non-negative, default: 2)
-C, --color BOOLEAN Enable/disable ANSI colors for source output (default: true). Accepts: yes/no/y/n/true/false/t/f/on/off/+/-/1/0
-S, --raise-on-stale BOOLEAN Raise error if coverage is stale (default: false). Accepts: yes/no/y/n/true/false/t/f/on/off/+/-/1/0
-g, --tracked-globs x,y,z Globs for filtering files (list/totals subcommands)
-h, --help Show help
-l, --log-file PATH Log file path (default ./cov_loupe.log, use stdout/stderr for streams)
-m, --mode MODE Execution mode: cli|mcp (default: cli)
-e, --error-mode MODE Error handling mode: o[ff]|l[og]|d[ebug] (default log). off (silent), log (log errors to file), debug (verbose with backtraces)
-v, --version Show version information and exit.
Examples:
cov-loupe --resultset coverage list
cov-loupe --format json --resultset coverage summary lib/foo.rb
cov-loupe --source uncovered --context-lines 2 uncovered lib/foo.rb
cov-loupe totals --format json