Documentation
¶
Overview ¶
Package testenv makes a test binary hermetic. HOME, the ledger, the asks and run dirs go under one temp root, and the developer's git config and shell environment are ignored. The Go caches are the one exception, kept on the developer's own by PinGoDirs. It imports nothing from this module, so any package's tests may use it. cmd/f10's tests check its paths against the real ones.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Cleared = []string{
"XDG_CONFIG_HOME", "F10_STATE_DIR", "F10_USER_DIR", "CLAUDE_CONFIG_DIR", "GH_CONFIG_DIR", "GLAB_CONFIG_DIR",
"F10_BATCH_FILE", "F10_BATCH_RESUMES", "F10_DRIVE_FILE", "F10_DRIVE_RESUMES",
"F10_AGENT_MODEL", "F10_AGENT_VIA", "F10_AGENT_SESSION",
"F10_SESSION_ID", "CLAUDE_CODE_SESSION_ID", "CLAUDECODE",
"HERDR_ENV", "HERDR_WORKSPACE_ID",
"F10_ROOTS", "F10_STATE_TTL", "F10_STATE_DEBUG",
"F10_PLUGIN_ROOT", "CLAUDE_PLUGIN_ROOT",
"F10_STANDUP_RECORD", "F10_BOARD_RECORD", "F10_STATUS_GLYPHS",
"XDG_RUNTIME_DIR",
}
Cleared is the environment the developer's shell may set, which would otherwise leak into the tests. The dir overrides among it are cleared, not pinned, so they follow HOME and a test that moves HOME moves them too.
var Root string
Root holds every user-level dir for the run, so a test that sets nothing still never reads or writes the developer's own HOME, bar the Go caches.
Functions ¶
func PinGoDirs ¶ added in v0.73.0
func PinGoDirs(home string)
PinGoDirs sets the Go caches and config to the values go resolves under home, so every child process keeps them whatever HOME a test moves to. Unlike the f10 dirs they are pinned, not cleared: left to follow a moved HOME, a build starts cold and writes a read-only module cache t.TempDir cannot remove. Without go it does nothing.
Types ¶
This section is empty.