histoire
Version:
A fast story book powered by Vite
19 lines • 1.14 kB
TypeScript
import type { TerminalLogEvent } from '@histoire/cli/protocol/core';
/** Handle returned by {@link installConsoleObserver}. */
export interface ConsoleObserver {
/** Starts forwarding intercepted emissions to `emit` instead of the raw stream; returning false (or throwing) writes the raw text instead. */
activate: (emit: (event: TerminalLogEvent) => boolean | void) => void;
/** Restores only hooks this observer still owns. */
dispose: () => void;
}
/**
* Observes console output at the point where Node writes the final text
* (the console's stream properties), so groups, tables, assertions, counters,
* timers and traces keep their exact formatting and indentation. Before
* `activate`, or if forwarding throws, text goes to the original stream, so
* nothing is dropped. Text above the log bound also takes the raw path. Direct `process.stdout/stderr` writes are never touched.
* Install before project code is imported.
* @param target Console to observe; defaults to the global one.
*/
export declare function installConsoleObserver(target?: Console): ConsoleObserver;
//# sourceMappingURL=console-hook.d.ts.map