Skip to content

Add BATS test suite and GHA CI workflow#7

Merged
albertodebortoli merged 1 commit intomainfrom
bats-tests
Mar 11, 2026
Merged

Add BATS test suite and GHA CI workflow#7
albertodebortoli merged 1 commit intomainfrom
bats-tests

Conversation

@albertodebortoli
Copy link
Member

@albertodebortoli albertodebortoli commented Mar 11, 2026

Summary

  • Adds a BATS-based test suite with 51 tests covering install.sh, uninstall.sh, shell_hook.sh, and post-checkout
  • Uses PATH-shadowing mocks (curl, git, luca, sudo, uname, unzip) for hermetic, side-effect-free testing
  • GHA workflow runs tests on both ubuntu-latest and macos-latest on every push and PR to main
  • Patches install.sh and uninstall.sh to support INSTALL_DIR env override (via ${INSTALL_DIR:-/usr/local/bin}) needed for test isolation

Test plan

  • GHA checks pass on both ubuntu-latest and macos-latest
  • Test 9 (os: Linux detected via /etc/os-release) is skipped on macOS and passes on Linux
  • All 51 tests pass locally: brew install bats-core && git clone --depth 1 https://github.com/bats-core/bats-support tests/test_helper/bats-support && git clone --depth 1 https://github.com/bats-core/bats-assert tests/test_helper/bats-assert && bats tests/*.bats

🤖 Generated with Claude Code

- 51 tests across install.bats, uninstall.bats, shell_hook.bats, post_checkout.bats
- PATH-shadowing mocks for curl, git, luca, sudo, uname, unzip
- Hermetic test isolation via temp HOME/INSTALL_DIR overrides
- GHA workflow runs on ubuntu-latest and macos-latest on push/PR
- Patch install.sh and uninstall.sh to support INSTALL_DIR env override

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@albertodebortoli albertodebortoli merged commit fdb756b into main Mar 11, 2026
2 checks passed
@albertodebortoli albertodebortoli deleted the bats-tests branch March 11, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant