MCPcopy
hub / github.com/promptfoo/promptfoo / createMockFileTransport

Function createMockFileTransport

test/logger.test.ts:763–778  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

761 it('should set shutdown flag when closing', async () => {
762 // Create mock file transports with once/end methods for proper flush handling
763 const createMockFileTransport = (filename: string) => {
764 const transport = {
765 filename,
766 once: vi.fn((event: string, callback: () => void) => {
767 // Immediately call the callback to simulate finish event
768 if (event === 'finish') {
769 setImmediate(callback);
770 }
771 }),
772 on: vi.fn(),
773 off: vi.fn(),
774 end: vi.fn(),
775 };
776 Object.setPrototypeOf(transport, winstonMock.transports.File.prototype);
777 return transport;
778 };
779
780 const mockFileTransport1 = createMockFileTransport('/mock/path/debug.log');
781 const mockFileTransport2 = createMockFileTransport('/mock/path/error.log');

Callers 1

logger.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…