Repository navigation
test(config): cover CLAUDE_CONFIG_DIR tilde-expansion and fallback branches - #3222
Merged
Merged
Conversation
…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]>
Collaborator
Author
|
CI is green — all required checks plus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #3215 (merged), where
codecov/patchflagged two uncovered lines in the newclaude_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 absoluteCLAUDE_CONFIG_DIR). The two misses were the~/-expansion branch and the unset fallback to~/.claude. Both were structurally unreachable from the existing suite becauseset_temp_home_envnow pinsCLAUDE_CONFIG_DIRto an absolute path for every test.The tests
Two
install-statuslineintegration tests, each overriding the pinned variable afterset_temp_home_env:test_plugins_claude_install_statusline_expands_tilde_in_claude_config_dir— setsCLAUDE_CONFIG_DIR=~/custom-claudeand asserts the statusline lands at<home>/custom-claude/settings.json, with no literal~directory created under the cwd. Covers thestrip_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 finalhome_dir().map(|home| home.join(".claude"))arm.Both pass locally (
cargo test --test integration test_plugins_claude_install_statusline— 7 passed),cargo fmt --checkclean.