mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-05 08:10:39 +00:00
Tests were flaky because command() inherited the real repo as the working directory. When the repo was clean, detached runs attempted git worktree creation against it, sometimes failing and injecting extra warning lines into snapshots. Now command() defaults to the non-git temp_dir, eliminating this class of flakiness. Tests needing a specific directory override with .current_dir(). Also canonicalizes fixture paths and adds a [FIXTURES] snapshot filter via test_context!() macro. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
30 lines
868 B
Rust
30 lines
868 B
Rust
use std::time::Duration;
|
|
|
|
use fabro_test::test_context;
|
|
|
|
#[fabro_macros::e2e_test(live("ANTHROPIC_API_KEY"))]
|
|
fn test_exec_creates_file() {
|
|
let context = test_context!();
|
|
|
|
let mut cmd = context.exec_cmd();
|
|
cmd.args([
|
|
"--auto-approve",
|
|
"--permissions",
|
|
"full",
|
|
"--provider",
|
|
"anthropic",
|
|
"--model",
|
|
"claude-haiku-4-5",
|
|
"Create a file called hello.txt containing exactly 'Hello from exec scenario'",
|
|
]);
|
|
cmd.timeout(Duration::from_secs(120));
|
|
cmd.assert().success();
|
|
|
|
let hello = context.temp_dir.join("hello.txt");
|
|
assert!(hello.exists(), "hello.txt should exist after exec");
|
|
let content = std::fs::read_to_string(&hello).unwrap();
|
|
assert!(
|
|
content.contains("Hello from exec scenario"),
|
|
"hello.txt should contain greeting, got: {content}"
|
|
);
|
|
}
|