Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

test(agents): keep ide-agent tests off the user's profile and git settings (#2168)

SunZhiQiang25cd480c3069
diff --git a/crates/ide-agent/src/skills.rs b/crates/ide-agent/src/skills.rs
index 63c1c21f3..48b69e264 100644
--- a/crates/ide-agent/src/skills.rs
+++ b/crates/ide-agent/src/skills.rs
@@ -211,7 +211,9 @@ mod tests {
#[test]
fn project_and_user_skills_and_commands() {
let tmp = tempfile::tempdir().unwrap();
- let home = tmp.path().join("home");
+ // Home is an ancestor of the project, so the walk stops there instead of climbing
+ // past it into the real profile (a temp dir under the user's home holds its skills).
+ let home = tmp.path().to_path_buf();
let repo = tmp.path().join("work").join("idea");
let skills = repo.join(".claude/skills");
write(
diff --git a/crates/ide-agent/src/tests.rs b/crates/ide-agent/src/tests.rs
index 9d5e4ef86..025bc98bb 100644
--- a/crates/ide-agent/src/tests.rs
+++ b/crates/ide-agent/src/tests.rs
@@ -357,7 +357,9 @@ fn manager_at(dir: &Path, models_file: &Path, agent: Arc<FakeAgent>) -> AgentMan
worktrees_dir: dir.join("worktrees"),
models_file: models_file.to_path_buf(),
custom_agents_dir: Some(agents),
- home_dir: None,
+ // The project is the boundary of the skill walk: nothing above it (such as the
+ // user's profile, when temp lives under it) leaks into the test.
+ home_dir: Some(dir.to_path_buf()),
},
tokio::runtime::Handle::current(),
connector,
@@ -1939,6 +1941,7 @@ async fn task_project_root_controls_local_and_worktree_repositories() {
String::from_utf8_lossy(&out.stdout).trim().to_owned()
};
git(&["init", "-q", "-b", "member-main"]);
+ git(&["config", "core.autocrlf", "false"]);
std::fs::write(member.join("file.txt"), "original\n").unwrap();
git(&["add", "."]);
git(&["commit", "-qm", "initial"]);
@@ -2252,6 +2255,7 @@ async fn delete_running_agent(no_load: bool) {
assert!(out.status.success(), "{}", String::from_utf8_lossy(&out.stderr));
};
git(&["init", "-q", "-b", "main"]);
+ git(&["config", "core.autocrlf", "false"]);
std::fs::write(root.join("file.txt"), "original\n").unwrap();
git(&["add", "."]);
git(&["commit", "-qm", "initial"]);