test: 🚨 exhaustive behavioral coverage for all scripts - #4
Conversation
Replace the syntax-only test.bats in every script folder with real behavioral suites (help/usage, argument validation, success/error paths, edge cases) run against throwaway git repos or temp dirs. Fixes surfaced by the new tests: - load-json: error exits were swallowed by piping into sed|jq - git-fix-base/-children/-date/-message/-privacy/-secrets: zz_ask return value was checked via exit code instead of stdout, so declining a destructive-rewrite confirmation prompt never actually cancelled it - git-fix-base: dry-run heredoc variable name was an invalid identifier - git-fix-children: grep no-match exit code aborted the whole script
Expand each script's boilerplate "## Tests" section with a bullet summary of what its test.bats suite actually exercises, matching the exhaustive behavioral coverage added in the previous commit.
|
Re-ran the failed job once. If it stays red, the underlying fix (adding a committed lockfile, or dropping Generated by Claude Code |
Summary
test.bats(previously just "installed on PATH +sh -nvalid") in every one of the 53 script folders with a real behavioral suite: help/usage output, argument validation, error paths (missing/invalid args, running outside a git repo), success paths, and script-specific edge cases — run against throwaway git repos or temp directories viatests/helpers.bash.zz_npx/zz_update's real npm/git-remote fetches, are covered by asserting the local-fixture fast path and that no network call occurs).npm test/bats --recursive .), up from the previous syntax-only checks.load-json: errorexit 1s were silently swallowed because they lived inside anif/elifblock piped intosed | jq, andjqexits 0 on empty stdin.git-fix-base,git-fix-children,git-fix-date,git-fix-message,git-fix-privacy,git-fix-secrets: several destructive-rewrite scripts checkedzz_ask's exit code (if ! zz_ask ...) instead of its printed answer, so answering "n" to "This will rewrite history, continue?" never actually cancelled the operation.git-fix-base: the-ndry-run heredoc declared an invalid shell variable name (dry-run), so the flag never worked.git-fix-children:grep's "no match" exit code (a normal case: no descendant branches to delete) aborted the whole script underset -e.README.md's Tests section to describe the new coverage.Test plan
npm test(bats --recursive .) — 417/417 passingnpx bats <dir>/test.batsGenerated by Claude Code