Files
donlucasandClaude Fable 5.1 4b86a5ac9b Four hygiene items from Kimi's assessment: a test that never ran, two log switches unscrubbed, an interrupt taken for a failure, a portability skip
The companion test for the near pose OFF skipped whenever Near was not
zero, and unset XSCAPES_NEAR has meant rung 2 since 2026-09-11, so it
skipped every run; it sets the pose off itself now. The test harness
scrubs XSCAPES_HOOKLOG and XSCAPES_EVENTLOG as it scrubs HOME and TRACE,
so no test can append to the logs of whoever runs the suite inside a
scape. A StopFailure flagged is_interrupt is the user's Esc and becomes an
Interrupt, as PostToolUseFailure's flag already did, instead of a worried
owl. The installer test skips rather than fails on a box whose Go lives
in /usr/bin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-18 13:19:48 -07:00

31 lines
1.0 KiB
Go

package main
import (
"os"
"testing"
)
// TestMain keeps the suite out of the user's real state.
//
// The adapter tests feed genuine hook payloads through translate(), and a
// SessionStart payload records its session as the current one -- which, with
// no override, means writing "s" into ~/.config/xscapes/run/current. That
// file is what a scape started by hand follows, so running the tests left the
// next `xscapes -live` chasing a session that never existed. Found on
// 2026-09-01 by reading the file while testing the launcher, not by any test:
// a suite that writes outside its temp dir cannot notice that it did.
func TestMain(m *testing.M) {
dir, err := os.MkdirTemp("", "xscapes-test")
if err != nil {
panic(err)
}
os.Setenv("XSCAPES_HOME", dir)
// The log switches too: a test that follows a live bus would otherwise
// append to the real logs of whoever runs the suite inside a scape.
os.Unsetenv("XSCAPES_HOOKLOG")
os.Unsetenv("XSCAPES_EVENTLOG")
code := m.Run()
os.RemoveAll(dir)
os.Exit(code)
}