mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-11 22:53:00 +00:00
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) <noreply@anthropic.com>
This commit is contained in:
parent
0a57367fee
commit
42f8ec271b
1 changed files with 9 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue