import { MessageClient , MessageLogger , MessageStreamClient , MessageStreamer } from "@adpt/utils" ; import { WritableStreamBuffer } from "stream-buffers" ; export interface MockLogger extends MessageLogger { stdout : string ; stderr : string ; } class MockLoggerImpl extends MessageStreamer implements MockLogger { outStream ! : WritableStreamBuffer ; errStream ! : WritableStreamBuffer ; constructor ( ) { super ( "MockLogger" , { outStream : new WritableStreamBuffer ( ) , errStream : new WritableStreamBuffer ( ) , outputOptions : { from : false , timestamp : false } , } ) ; } get stdout ( ) { return this . outStream . getContentsAsString ( ) || "" ; } get stderr ( ) { return this . errStream . getContentsAsString ( ) || "" ; } } export function createMockLogger ( ) { return new MockLoggerImpl ( ) ; } export interface MockLoggerClient extends MessageClient { stdout : string ; stderr : string ; } class MockLoggerClientImpl extends MessageStreamClient implements MockLoggerClient { outStream ! : WritableStreamBuffer ; errStream ! : WritableStreamBuffer ; constructor ( ) { super ( { outStream : new WritableStreamBuffer ( ) , errStream : new WritableStreamBuffer ( ) , } ) ; } get stdout ( ) { return this . outStream . getContentsAsString ( ) || "" ; } get stderr ( ) { return this . errStream . getContentsAsString ( ) || "" ; } } export function createMockLoggerClient ( ) { return new MockLoggerClientImpl ( ) ; }