diff --git a/crates/agent2/src/agent2.rs b/crates/agent2/src/agent2.rs index 519e23f35e77f887955c01b070a4336d0b6b2d65..d4e976f48841f962001d00d60682e02f1f5fdd4b 100644 --- a/crates/agent2/src/agent2.rs +++ b/crates/agent2/src/agent2.rs @@ -231,7 +231,7 @@ mod tests { use project::FakeFs; use serde_json::json; use settings::SettingsStore; - use std::{env, process::Stdio}; + use std::{env, path::Path, process::Stdio}; use util::path; fn init_test(cx: &mut TestAppContext) { @@ -252,11 +252,11 @@ mod tests { let fs = FakeFs::new(cx.executor()); fs.insert_tree( - path!("/tmp"), + path!("/private/tmp"), json!({"foo": "Lorem ipsum dolor", "bar": "bar", "baz": "baz"}), ) .await; - let project = Project::test(fs, [path!("/tmp").as_ref()], cx).await; + let project = Project::test(fs, [path!("/private/tmp").as_ref()], cx).await; let agent = gemini_agent(project.clone(), cx.to_async()).unwrap(); let thread_store = ThreadStore::load(Arc::new(agent), project, &mut cx.to_async()) .await @@ -274,7 +274,8 @@ mod tests { Message { role: Role::User, chunks: vec![ - "Read the '/tmp/foo' file and output all of its contents.".into(), + "Read the '/private/tmp/foo' file and output all of its contents." + .into(), ], }, cx, @@ -287,7 +288,7 @@ mod tests { thread.entries().iter().any(|entry| { entry.content == AgentThreadEntryContent::ReadFile { - path: "/tmp/foo".into(), + path: "/private/tmp/foo".into(), content: "Lorem ipsum dolor".into(), } }), @@ -298,11 +299,13 @@ mod tests { } pub fn gemini_agent(project: Entity, cx: AsyncApp) -> Result { + let cli_path = + Path::new(env!("CARGO_MANIFEST_DIR")).join("../../../gemini-cli/packages/cli"); let child = util::command::new_smol_command("node") - .arg("../../../gemini-cli/packages/cli") + .arg(cli_path) .arg("--acp") .args(["--model", "gemini-2.5-flash"]) - .env("GEMINI_API_KEY", env::var("GEMINI_API_KEY").unwrap()) + .current_dir("/private/tmp") .stdin(Stdio::piped()) .stdout(Stdio::piped()) .stderr(Stdio::inherit())