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)
| 20 | // exercise bg behavior override it via stubBGCommand and restore on |
| 21 | // cleanup. |
| 22 | func 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 = ¬BG |
| 35 | os.Exit(m.Run()) |
| 36 | } |
| 37 | |
| 38 | const bgFullSID = "48d287d9-1ef0-4738-84b9-3110beb988c4" |
| 39 |
nothing calls this directly
no outgoing calls
no test coverage detected