Summary
Add automated testing to cac. Currently CI only has ShellCheck + build consistency + JS syntax check. No functional or integration tests.
Scope
Unit tests (bats-core)
- UUID/hostname/MAC generation format validation
- Proxy parsing (
_parse_proxy, _auto_detect_proxy)
- Version semver sorting
- Platform detection (
_detect_os, _detect_platform)
Integration tests
cac env create → verify file structure (uuid, stable_id, proxy, .claude/settings.json, etc.)
cac env check → mock proxy, verify output
- Wrapper injection → verify environment variables are set correctly
fingerprint-hook.js → verify interception works
E2E tests
- Docker container running full workflow
- Multi-platform CI (macOS + Linux)
Getting started
# Install bats-core
brew install bats-core # macOS
apt install bats # Linux
# Run tests
bats tests/
References
Summary
Add automated testing to cac. Currently CI only has ShellCheck + build consistency + JS syntax check. No functional or integration tests.
Scope
Unit tests (bats-core)
_parse_proxy,_auto_detect_proxy)_detect_os,_detect_platform)Integration tests
cac env create→ verify file structure (uuid,stable_id,proxy,.claude/settings.json, etc.)cac env check→ mock proxy, verify outputfingerprint-hook.js→ verify interception worksE2E tests
Getting started
References
.github/workflows/