Skip to content

Add test suite for install and uninstall scripts - #1

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784363637-test-install-scripts
Open

Add test suite for install and uninstall scripts#1
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784363637-test-install-scripts

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

install.sh and uninstall.sh are the only executable code in this repo and had zero automated coverage — the rest is Markdown skill definitions. This adds a bats suite (16 tests) for both scripts, the modules with the least coverage.

Each test runs the real script against a throwaway sandbox via env overrides (HOME, CLAUDE_HOME, CLAUDE_SKILLS_DIR, CODEX_HOME, CODEX_SKILLS_DIR), so the suite never touches the developer's real Claude/Codex config.

Coverage:

  • Stow wiring — skills symlinked into both Claude and Codex targets; repo metadata (README.md, AGENTS.md, install.sh, uninstall.sh) excluded; AGENTS.md linked as ~/.claude/CLAUDE.md.
  • remove_link_if_target logic — legacy renamed-skill links (e.g. write-a-prd, caveman) that resolve into the repo are removed, while same-named links pointing elsewhere are left untouched (this is the trickiest branch — it resolves relative symlink targets before comparing).
  • Idempotency — running install twice, and uninstall twice, both stay green.
  • Error path — both scripts exit 1 with the "GNU Stow is required" message when stow is absent, exercised via a PATH stripped of stow but retaining the other coreutils the scripts need.
  • Teardown — uninstall removes skill links, the repo-owned CLAUDE.md, and empty skills dirs, but leaves a foreign CLAUDE.md alone.

Run with:

./tests/run.sh   # checks for bats + stow, then runs bats tests/

tests/helper.bash holds the shared sandbox setup and an assert_symlink_to helper. All 16 tests pass and shellcheck is clean on the scripts and helpers.

Link to Devin session: https://app.devin.ai/sessions/7ec072a7005b41d8844b1a41acf1ebf1
Requested by: @sidwood

The install and uninstall scripts had no automated coverage, so
regressions in the Stow wiring or the legacy-symlink cleanup would go
unnoticed until they broke a real setup.

- Add a bats suite exercising both scripts in a sandbox HOME, covering
  symlink creation, metadata exclusion, CLAUDE.md linking, idempotency,
  legacy-link removal, and the missing-Stow error path

- Add tests/run.sh as a dependency-checking entry point
@sidwood sidwood self-assigned this Jul 18, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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