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

Function TestMain

internal/app/background_test.go:22–36  ·  view source on GitHub ↗

TestMain defaults claude.BGCommandRunner to an empty background-agent registry for the whole app test package. Without this, every show / list / do over a session-bound task would spawn a real `claude agents --json` subprocess (slow + non-hermetic). Tests that exercise bg behavior override it via st

(m *testing.M)

Source from the content-addressed store, hash-verified

20// exercise bg behavior override it via stubBGCommand and restore on
21// cleanup.
22func TestMain(m *testing.M) {
23 claude.BGCommandRunner = func(workDir string, args []string) ([]byte, error) {
24 if len(args) >= 1 && args[0] == "agents" {
25 return []byte("[]"), nil
26 }
27 return nil, fmt.Errorf("BGCommandRunner not stubbed for args %v", args)
28 }
29 // Insulate the suite from an ambient $FLOW_TERM=bg in the developer's
30 // environment: default the whole app package to NON-background so
31 // cmdDo tests exercise the terminal path. bg tests opt in via
32 // stubBGMode (which saves/restores this override).
33 notBG := false
34 spawner.BackgroundOverride = &notBG
35 os.Exit(m.Run())
36}
37
38const bgFullSID = "48d287d9-1ef0-4738-84b9-3110beb988c4"
39

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected