wt: Add test coverage for removal protection feature
Status Closed — not planned
Maintainer reply None cached
Activity 2 comments · opened Jan 28, 2026 · closed Mar 1, 2026
Context
The worktree removal protection feature added in the PR for wt rm safety checks currently lacks test coverage.
Suggested Test Cases
getWorktreeStatus()returns correct counts for various git states:
- Untracked files detection
- Staged file count
- Unstaged file count
- Ahead count with upstream
- Null ahead count when no upstream
hasStatusIssues()correctly identifies when warnings are needed:
- Returns true for untracked files
- Returns true for staged changes
- Returns true for unstaged changes
- Returns true for unpushed commits
- Returns true for no upstream (never pushed)
- Returns false for clean worktree
removeCommand()integration:
- Non-TTY mode throws
CliErrorwhen status issues exist without--force --forceflag bypasses all checks- Clean worktree proceeds without prompting
Files
packages/wt/src/init/detect.ts-getWorktreeStatus()packages/wt/src/commands/remove.ts-hasStatusIssues(),printWorktreeWarnings(), removal flow
Priority
Medium - This is a safety-critical feature that prevents data loss.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗