murmuraba
Version:
Real-time audio noise reduction with advanced chunked processing for web applications
74 lines • 2.22 kB
TypeScript
import { type MockInstance } from 'vitest';
/**
* Centralized console mocking utilities
* Provides consistent console mocking across all tests
*/
export interface ConsoleMocks {
log: MockInstance;
error: MockInstance;
warn: MockInstance;
info: MockInstance;
debug: MockInstance;
trace: MockInstance;
table: MockInstance;
group: MockInstance;
groupEnd: MockInstance;
}
export interface ConsoleMockOptions {
silent?: boolean;
showEmojis?: boolean;
showErrors?: boolean;
showWarnings?: boolean;
captureOutput?: boolean;
}
export declare class ConsoleCapture {
private captured;
constructor();
reset(): void;
capture(method: keyof ConsoleMocks, args: any[]): void;
getOutput(method?: keyof ConsoleMocks): any[][];
getLogs(): any[][];
getErrors(): any[][];
getWarnings(): any[][];
hasLogs(): boolean;
hasErrors(): boolean;
hasWarnings(): boolean;
findLog(pattern: string | RegExp): any[] | undefined;
findError(pattern: string | RegExp): any[] | undefined;
}
/**
* Mock all console methods with options
*/
export declare function mockConsole(options?: ConsoleMockOptions): ConsoleMocks & {
capture?: ConsoleCapture;
};
/**
* Restore all console mocks
*/
export declare function restoreConsole(mocks: ConsoleMocks): void;
/**
* Helper for using console mocks in beforeEach/afterEach
*/
export declare function useConsoleMocks(options?: ConsoleMockOptions): () => ConsoleMocks & {
capture?: ConsoleCapture;
};
/**
* Temporarily suppress console output for a specific function
*/
export declare function withSuppressedConsole<T>(fn: () => T | Promise<T>, options?: ConsoleMockOptions): Promise<T>;
/**
* Assert console output patterns
*/
export declare class ConsoleAssertions {
private mocks;
constructor(mocks: ConsoleMocks);
expectLog(pattern: string | RegExp): void;
expectError(pattern: string | RegExp): void;
expectWarning(pattern: string | RegExp): void;
expectNoLogs(): void;
expectNoErrors(): void;
expectNoWarnings(): void;
expectLogCount(count: number): void;
expectErrorCount(count: number): void;
}
//# sourceMappingURL=console-utils.d.ts.map