Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

refactor: simplify dev/coverage.sh (#541)

Maximilian Roos75c39245d9e5
diff --git a/CLAUDE.md b/CLAUDE.md
index bf7ced37e..38b8c158f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -170,9 +170,12 @@ The `codecov/patch` CI check enforces coverage on changed lines — respond to f
### Running Coverage Locally
-- Install once: `cargo install cargo-llvm-cov`
-- Run: `./dev/coverage.sh` — generates HTML (`target/llvm-cov/html/index.html`) and LCOV
-- Filter tests: `./dev/coverage.sh -- --test test_name`
+```bash
+./dev/coverage.sh
+# Report: target/llvm-cov/html/index.html
+```
+
+Install once: `cargo install cargo-llvm-cov`
### Investigating codecov/patch Failures
diff --git a/dev/coverage.sh b/dev/coverage.sh
index 9d27afd53..1ae9efdbc 100755
--- a/dev/coverage.sh
+++ b/dev/coverage.sh
@@ -1,38 +1,2 @@
#!/usr/bin/env bash
-set -euo pipefail
-
-if ! command -v cargo-llvm-cov >/dev/null 2>&1; then
- echo "cargo-llvm-cov is required. Install with: cargo install cargo-llvm-cov" >&2
- exit 1
-fi
-
-# Always use the repo's pinned toolchain so llvm-tools are found even if the
-# default cargo is a Homebrew build.
-SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
-TOOLCHAIN="$(awk -F '\"' '/^channel/ {print $2; exit}' "${SCRIPT_DIR}/../rust-toolchain.toml")"
-if command -v rustup >/dev/null 2>&1; then
- CARGO_BIN=(rustup run "${TOOLCHAIN}" cargo)
-else
- CARGO_BIN=(cargo)
-fi
-
-# Ensure LLVM tools are available for coverage instrumentation.
-if ! rustup component list --installed | grep -Eq '^llvm-tools(-preview)?'; then
- rustup component add llvm-tools-preview
-fi
-
-COVERAGE_DIR="target/llvm-cov"
-LCOV_PATH="${COVERAGE_DIR}/lcov.info"
-mkdir -p "${COVERAGE_DIR}"
-
-# Include shell-integration-tests feature for comprehensive coverage of TUI/PTY code.
-
-# Run tests once with instrumentation, without generating a report yet.
-"${CARGO_BIN[@]}" llvm-cov --locked --workspace --no-report --features shell-integration-tests "$@"
-
-# Generate HTML and LCOV reports from the recorded data without rerunning tests.
-"${CARGO_BIN[@]}" llvm-cov report --html --output-dir "${COVERAGE_DIR}/html"
-"${CARGO_BIN[@]}" llvm-cov report --lcov --output-path "${LCOV_PATH}"
-
-echo "HTML report: ${COVERAGE_DIR}/html/index.html"
-echo "LCOV report: ${LCOV_PATH}"
+exec cargo llvm-cov --html --features shell-integration-tests "$@"