A dead simple Bash testing framework with coverage reporting, offering a familiar API and custom assertion flexibility.
critic.sh is a testing framework for Bash scripts that provides a simple API for writing tests and generates coverage reports. It solves the problem of testing Bash code with an intuitive interface and the ability to track which lines and functions are executed, helping developers improve test quality over time.
Developers and DevOps engineers who write and maintain Bash scripts and need a reliable way to test them with coverage insights.
Developers choose critic.sh for its familiar testing API, flexibility in using custom shell expressions for assertions, and built-in coverage reporting that works with lcov, making it a comprehensive tool for Bash testing.
Dead simple testing framework for Bash with coverage reporting
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses _describe, _test, and _assert functions similar to other frameworks, making it easy for developers to adopt if they have experience with testing tools like RSpec or Jasmine.
Allows any shell expression to be passed to _test and _assert methods, not limited to built-ins, enabling highly tailored tests for complex Bash logic.
Generates lcov reports to track line and function coverage, helping identify untested code and improve test quality over time, as highlighted in the README.
Provides a Docker image for easy setup and execution in CI/CD pipelines, with CRITIC_SETUP environment variable for pre-test installations like apk add jq.
Supports ignoring code blocks from coverage with # critic ignore annotations, allowing fine-grained control over what gets measured in reports.
Coverage reporting only tracks lines and functions, not branches, which limits the depth of analysis compared to more comprehensive testing tools.
Requires Bash v4.1 or higher due to bashisms, making it incompatible with older systems or legacy environments that use earlier versions.
The built-in assertion library is small (e.g., _return_true, _output_equals), so teams may need to write more custom expressions for complex tests, increasing initial effort.
The README explicitly states coverage is 'a work in progress,' which may imply instability or incomplete functionality in reporting, such as potential bugs or missing features.