fix(team-mode): refactor layout to use testable spawn-process helper
The existing layout.test.ts relied on mock.module("bun", ...) registered
at the top level, but test-setup.ts calls mock.restore() + restoreModuleMocks()
in afterEach, so every test except the first one lost its mocks. CI has
been red on this file since e303feef.
Two changes:
1. layout.ts now imports spawn from the existing spawn-process helper
instead of "bun" directly, matching the pattern established for
closeTmuxPane and killTmuxSessionIfExists. This does not change
runtime behavior - spawn-process just re-exports Bun's spawn.
2. layout.test.ts registers module mocks inside beforeEach and uses the
?test=UUID cache-busting dynamic-import pattern so the mocks apply
on every test run, not just the first.
All 4 layout.test.ts cases now pass.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { spawn } from "bun"
|
||||
import { spawn } from "../../../shared/tmux/tmux-utils/spawn-process"
|
||||
import { log } from "../../../shared"
|
||||
import { getTmuxPath } from "../../../tools/interactive-bash/tmux-path-resolver"
|
||||
import type { TmuxSessionManager } from "../../tmux-subagent/manager"
|
||||
|
||||
Reference in New Issue
Block a user