Skip to content

Local fixture tests overwrite a managed tool

Source: Troubleshooting reference

Symptom: Remote-bootstrap tests fail to find their fake chezmoi, while the real chezmoi --version unexpectedly prints chezmoi version test. Fish profile fixtures can also resolve live runtime directories instead of their fake home.

Root cause: Setting a fixture’s HOME does not override exported DF_TOOLS_ROOT, DF_STATE_ROOT, CODEX_HOME, or other managed runtime variables. The fixture can therefore write into the real installation. A host overlay can also restore these roots if the test only unsets the variables.

Confirm: Inspect the executable reported by command -v chezmoi with file; the fixture stub is a short shell script containing the test version. Inspect path variables without printing credential values.

Fix: Stop the affected test run, preserve the confirmed stub outside the managed executable path, and restore chezmoi with bash install/chezmoi.sh. Use the updated tests/ci.sh, whose Bats subprocess clears inherited runtime and build settings and exports empty root overrides. Writing fixtures also set their temporary roots explicitly. Rerun ./tests/ci.sh fast; the regression checks require inherited tool and state directories to remain untouched.