test(cli): isolate OMNIGRAPH_CONFIG/XDG_CONFIG_HOME in the spawn helpers

cli()/cli_process() set OMNIGRAPH_HOME but inherited OMNIGRAPH_CONFIG (which wins over
HOME) and XDG_CONFIG_HOME, so a developer/CI with those exported got non-hermetic tests.
env_remove both so the harness fully owns the config-resolution env; tests that exercise
global-first still set OMNIGRAPH_CONFIG explicitly per-invocation.
This commit is contained in:
Ragnor Comerford 2026-06-05 12:46:24 +02:00
parent 922666fc70
commit a4fd847f7d
No known key found for this signature in database

View file

@ -25,13 +25,19 @@ fn isolated_omnigraph_home() -> &'static Path {
pub fn cli() -> Command {
let mut command = Command::cargo_bin("omnigraph").unwrap();
command.env("OMNIGRAPH_HOME", isolated_omnigraph_home());
command
.env("OMNIGRAPH_HOME", isolated_omnigraph_home())
.env_remove("OMNIGRAPH_CONFIG")
.env_remove("XDG_CONFIG_HOME");
command
}
pub fn cli_process() -> StdCommand {
let mut command = StdCommand::new(assert_cmd::cargo::cargo_bin("omnigraph"));
command.env("OMNIGRAPH_HOME", isolated_omnigraph_home());
command
.env("OMNIGRAPH_HOME", isolated_omnigraph_home())
.env_remove("OMNIGRAPH_CONFIG")
.env_remove("XDG_CONFIG_HOME");
command
}