Skip to content

Commit 4a2c381

Browse files
authored
test(memory): model qmd child stream encoding (#107827)
1 parent be88c46 commit 4a2c381

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎extensions/memory-core/src/memory/qmd-manager.slugified-paths.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@ const { logWarnMock, logDebugMock, logInfoMock } = vi.hoisted(() => ({
1313
logInfoMock: vi.fn(),
1414
}));
1515

16+
type MockStream = EventEmitter & { setEncoding: ReturnType<typeof vi.fn> };
17+
1618
interface MockChild extends EventEmitter {
17-
stdout: EventEmitter;
18-
stderr: EventEmitter;
19+
stdout: MockStream;
20+
stderr: MockStream;
1921
kill: (signal?: NodeJS.Signals) => void;
2022
closeWith: (code?: number | null) => void;
2123
}
2224

2325
function createMockChild(params?: { autoClose?: boolean }): MockChild {
24-
const stdout = new EventEmitter();
25-
const stderr = new EventEmitter();
26+
const stdout = Object.assign(new EventEmitter(), { setEncoding: vi.fn() });
27+
const stderr = Object.assign(new EventEmitter(), { setEncoding: vi.fn() });
2628
const child = new EventEmitter() as unknown as MockChild;
2729
child.stdout = stdout;
2830
child.stderr = stderr;

0 commit comments

Comments
 (0)