From 42f8ec271b27eb7072e22309628f13ea6084739c Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Fri, 10 Apr 2026 08:49:44 -0400 Subject: [PATCH] test(fabro-test): scrub FABRO_* env from spawned subprocesses TestContext::command() was inheriting all parent env vars, so a developer (or CI) running with FABRO_CONFIG set would pollute child test subprocesses, causing settings_local_* IT tests to fail with opaque assertion errors. Iterate std::env::vars_os() and env_remove every FABRO_* key before re-adding the controlled set (FABRO_NO_UPGRADE_CHECK, etc.). Safe to iterate because the prior two commits eliminated all std::env::set_var callers in fabro-cli and fabro-config tests. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/crates/fabro-test/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/crates/fabro-test/src/lib.rs b/lib/crates/fabro-test/src/lib.rs index b7af329d6..e7c58f914 100644 --- a/lib/crates/fabro-test/src/lib.rs +++ b/lib/crates/fabro-test/src/lib.rs @@ -924,6 +924,15 @@ impl TestContext { pub fn command(&self) -> Command { let mut cmd = Command::new(&self.fabro_bin); cmd.current_dir(&self.temp_dir); + // Scrub all inherited FABRO_* env so a developer running with + // e.g. FABRO_CONFIG=/some/path doesn't pollute child processes. + for (key, _) in std::env::vars_os() { + if let Some(s) = key.to_str() { + if s.starts_with("FABRO_") { + cmd.env_remove(&key); + } + } + } cmd.env("NO_COLOR", "1"); cmd.env("HOME", &self.home_dir); cmd.env("FABRO_NO_UPGRADE_CHECK", "true");