J.U.S.T. Bash Coverage Functions

just_bashcov_functions.bsh

Plugin for running bashcov which uses simplecov under the hood.

J.U.S.T. bashcov plugin

bashcov_defaultify

Plugin for running unit tests through bash coverage in any project

${JUST_PROJECT_PREFIX}_BASHCOV_SOURCE_DIR

The location of the source code directory on the host. The coverage results will be stored in a coverage subdirectory.

Bugs

Changing the coverage_dir in the settings may not work.

Default: ${${JUST_PROJECT_PREFIX}_CWD}

BASHCOV_IMAGE

The image name used to run bashcov. If you want to use your own customized image with your own dependencies installed, override the set BASHCOV_IMAGE in your local.env file to the image you want to use, and do NOT run bashcov_build or it will rebuild the bashconv image, tagging it with that image name.

Default: vsiri/bashcov:latest

Bashcov can be configured with a .simplecov file in the the ${JUST_PROJECT_PREFIX}_BASHCOV_SOURCE_DIR directory. See simplecov for more information on configuring .simplecov

Example

.simplecov
SimpleCov.start do
  # Exclude the tests and docs dir from the coverage report
  add_filter "/tests/"
  add_filter "/docs/"
  # Customize the no coverage flag, default is nocov
  nocov_token "nocov"
end
just bashcov

Run bashcov on a single command.

Arguments:

$1… - Arguments passed into bashcov call

just bashcov multiple

Run multiple commands in bashcov in parallel. The results are all merged together and allows you to only rerun a single file at a time and update the aggregate result.

Arguments:

$1… - Arguments passed to bashcov, one argument per call.

just bashcov resume

Similar to bashcov_multiple, except only executes each argument if it hasn’t been run before. Useful for resuming a long run, the first time.

Arguments:

$1… - Arguments passed to bashcov, one argument per call.

just bashcov shell

Enter the bashcov container; for debugging

just bashcov build

Builds the bashcov image. This is done automatically the first time you run a bashcov container, but this will rebuild it if needed.

just bashcov open

Opens the bashcov report in a web browser