MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestBackgroundOverrideBeatsEnv

Function TestBackgroundOverrideBeatsEnv

internal/spawner/spawner_test.go:44–60  ·  view source on GitHub ↗

TestBackgroundOverrideBeatsEnv confirms the test escape hatch: setting BackgroundOverride pins IsBackground regardless of $FLOW_TERM, so tests can force bg mode on or off without env mutation.

(t *testing.T)

Source from the content-addressed store, hash-verified

42// BackgroundOverride pins IsBackground regardless of $FLOW_TERM, so tests
43// can force bg mode on or off without env mutation.
44func TestBackgroundOverrideBeatsEnv(t *testing.T) {
45 t.Cleanup(func() { BackgroundOverride = nil })
46
47 t.Setenv("FLOW_TERM", "iterm")
48 tru := true
49 BackgroundOverride = &tru
50 if !IsBackground() {
51 t.Errorf("BackgroundOverride=true: IsBackground()=false, want true")
52 }
53
54 t.Setenv("FLOW_TERM", "bg")
55 fls := false
56 BackgroundOverride = &fls
57 if IsBackground() {
58 t.Errorf("BackgroundOverride=false: IsBackground()=true, want false")
59 }
60}
61
62// TestDetectFromEnv verifies the TERM_PROGRAM → backend mapping. The
63// Override knob and the ZELLIJ / kitty / FLOW_TERM checks have higher

Callers

nothing calls this directly

Calls 1

IsBackgroundFunction · 0.85

Tested by

no test coverage detected