From 23e8cfbd5b22179684276bef4131e26b830ce69c Mon Sep 17 00:00:00 2001 From: 0xfandom <50949929+0xfandom@users.noreply.github.com> Date: Wed, 22 Apr 2026 23:06:42 +0530 Subject: [PATCH] fix(test): add missing teammate exports to hookChains integration mock (#840) mock.module('./teammate.js', ...) only declared getAgentName/getTeamName/ getTeammateColor. Bun applies module mocks process-globally and mock.restore() does not undo them, so whenever another test file ran after hookChains.integration.test.ts and reached the real teammate module it received undefined for isTeammate/isPlanModeRequired/ getAgentId/getParentSessionId. This surfaced in CI as intermittent failures in src/commands/provider/provider.test.tsx (TextEntryDialog / wizard remount / ProviderWizard hides Codex OAuth), because getDefaultAppState in AppStateStore.ts calls teammateUtils.isTeammate(). Match the mock surface to the real teammate.ts exports so downstream consumers keep working even after the integration test pollutes the module cache. Keeps the same behavioral overrides this test needed. Closes #839 --- src/utils/hookChains.integration.test.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/hookChains.integration.test.ts b/src/utils/hookChains.integration.test.ts index f4de9ee5..dec63f01 100644 --- a/src/utils/hookChains.integration.test.ts +++ b/src/utils/hookChains.integration.test.ts @@ -75,6 +75,13 @@ async function importHookChainsHarness( getAgentName: () => senderName, getTeamName: () => teamName, getTeammateColor: () => 'blue', + // Keep parity with the real module's surface so later tests that + // run after this file (mock.module is process-global and mock.restore + // does not undo module mocks in Bun) do not see undefined members. + isTeammate: () => false, + isPlanModeRequired: () => false, + getAgentId: () => undefined, + getParentSessionId: () => undefined, })) mock.module('../bridge/replBridgeHandle.js', () => ({