Skip to content

test(config): cover CLAUDE_CONFIG_DIR tilde-expansion and fallback branches - #3222

Merged
max-sixty merged 1 commit into
mainfrom
test/claude-config-dir-coverage-28143984518
Jun 25, 2026
Merged

max-sixty merged 1 commit into
mainfrom
test/claude-config-dir-coverage-28143984518

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Follow-up to #3215 (merged), where codecov/patch flagged two uncovered lines in the new claude_config_dir() helper. Per @max-sixty's request to push coverage for those.

The gap

claude_config_dir() has three paths; #3215's test only exercised one (an absolute CLAUDE_CONFIG_DIR). The two misses were the ~/-expansion branch and the unset fallback to ~/.claude. Both were structurally unreachable from the existing suite because set_temp_home_env now pins CLAUDE_CONFIG_DIR to an absolute path for every test.

The tests

Two install-statusline integration tests, each overriding the pinned variable after set_temp_home_env:

  • test_plugins_claude_install_statusline_expands_tilde_in_claude_config_dir — sets CLAUDE_CONFIG_DIR=~/custom-claude and asserts the statusline lands at <home>/custom-claude/settings.json, with no literal ~ directory created under the cwd. Covers the strip_prefix("~/") expansion branch.
  • test_plugins_claude_install_statusline_falls_back_to_dot_claude — env_removes the variable and asserts the fallback to ~/.claude/settings.json. Covers the final home_dir().map(|home| home.join(".claude")) arm.

Both pass locally (cargo test --test integration test_plugins_claude_install_statusline — 7 passed), cargo fmt --check clean.

…anches

#3215 added `claude_config_dir()` but codecov/patch flagged two uncovered
lines: the `~/` expansion branch (set outside a shell) and the unset
fallback to `~/.claude`. The existing test only exercised an absolute
`CLAUDE_CONFIG_DIR`, and `set_temp_home_env` now pins the variable for every
test, so neither branch was hit.

Add two `install-statusline` integration tests: one sets
`CLAUDE_CONFIG_DIR=~/custom-claude` and asserts the statusline lands at
`<home>/custom-claude/settings.json` (no literal `~` directory under the
cwd); the other unsets the variable and asserts the fallback to
`~/.claude/settings.json`.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

CI is green — all required checks plus codecov/patch and codecov/project pass. Both previously-uncovered branches in claude_config_dir() are now exercised. Ready to merge whenever you are.

@max-sixty
max-sixty merged commit c1953c8 into main Jun 25, 2026
46 of 47 checks passed
@max-sixty
max-sixty deleted the test/claude-config-dir-coverage-28143984518 branch June 25, 2026 04:43
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.

2 participants