Skip to content

feat: test framework with bats-core #31

@nmhjklnm

Description

@nmhjklnm

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Critical priorityhelp wantedExtra attention is neededtestingTests and CI

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions