Test & Coverage Script
Shell script to run tests with coverage and exit on failure.
Automating test execution in a repeatable way helps integrate testing into local workflows and CI pipelines. This bash script runs your test suite with coverage enabled and fails fast on errors. It also prints a friendly message on completion.
#!/usr/bin/env bash
set -euo pipefail
echo "Running tests…"
# Run tests with coverage (adjust command for your test runner)
npm test -- --coverage
echo "✅ All tests passed! Coverage report generated."
Make sure this script is executable with chmod +x test.sh
and adjust the test command if you’re using Jest, Mocha, or another framework. It’s a simple convenience that ensures you don’t accidentally push code without running the test suite.