Skip to content

Commit 3919ade

Browse files
committed
fix(telemetry): use partial mock for telemetry/index.js in coreToolScheduler tests
The full mock shadowed all re-exports (logToolCall, etc.) causing 49 test failures. Use importActual to preserve other exports, only override span functions.
1 parent c485ac1 commit 3919ade

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/core/src/core/coreToolScheduler.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ function createMockToolSpan(
123123
});
124124
}
125125

126-
vi.mock('../telemetry/index.js', () => ({
127-
startToolSpan: vi.fn(
126+
vi.mock('../telemetry/index.js', async (importOriginal) => {
127+
const actual = await importOriginal<Record<string, unknown>>();
128+
return {
129+
...actual,
130+
startToolSpan: vi.fn(
128131
(name: string, attrs?: Record<string, string | number | boolean>) =>
129132
createMockToolSpan(`tool.${name}`, { tool_name: name, ...attrs }),
130133
),
@@ -164,7 +167,8 @@ vi.mock('../telemetry/index.js', () => ({
164167
}
165168
},
166169
),
167-
}));
170+
};
171+
});
168172

169173
vi.mock('fs/promises', () => ({
170174
writeFile: vi.fn(),

0 commit comments

Comments
 (0)