import type { WriteStream } from 'node:tty'; import type { styleText } from 'node:util'; import type { Snippet, TestStepResultStatus } from '@cucumber/messages'; export type Style = Parameters[0]; export { TestStepResultStatus } from '@cucumber/messages'; export type FormatCodeFunction = (snippet: Snippet, stream: NodeJS.WritableStream) => string; export interface Theme { affix?: Style; attachment?: Style; dataTable?: { all?: Style; border?: Style; content?: Style; }; docString?: { all?: Style; content?: Style; delimiter?: Style; mediaType?: Style; }; feature?: { all?: Style; keyword?: Style; name?: Style; }; location?: Style; rule?: { all?: Style; keyword?: Style; name?: Style; }; scenario?: { all?: Style; keyword?: Style; name?: Style; }; status?: { all?: Partial>; icon?: Partial>; progress?: Partial>; }; step?: { argument?: Style; keyword?: Style; text?: Style; }; tag?: Style; symbol?: { bullet?: string; }; } /** * Options for the PrettyPrinter */ export interface PrettyOptions { /** * Whether to include attachments in the output * @defaultValue true */ includeAttachments?: boolean; /** * Whether to include feature headers in the output * @defaultValue true */ includeFeatureLine?: boolean; /** * Whether to include rule headers in the output * @defaultValue true */ includeRuleLine?: boolean; /** * Whether to print a summary at the end of the test run * @defaultValue false */ summarise?: boolean; /** * Whether to show status icons alongside step results * @defaultValue true */ useStatusIcon?: boolean; /** * Theme for styling the output */ theme?: Theme; /** * Custom function for formatting code snippets before printing */ formatCode?: FormatCodeFunction; } /** * Options for the ProgressPrinter */ export interface ProgressOptions { /** * Whether to include attachments in the summary output * @defaultValue true */ includeAttachments?: boolean; /** * Whether to print a summary at the end of the test run * @defaultValue false */ summarise?: boolean; /** * Theme for styling the output */ theme?: Theme; /** * Custom function for formatting code snippets before printing */ formatCode?: FormatCodeFunction; } /** * Options for the ProgressBarPrinter */ export interface ProgressBarOptions { /** * Custom function for formatting code snippets before printing */ formatCode?: FormatCodeFunction; /** * Whether to include attachments in the summary output * @defaultValue true */ includeAttachments?: boolean; /** * How to handle writes to stdout/stderr from outside the printer during a run * - `passthrough`: let all writes through (may garble the progress bar) * - `suppress`: silently discard writes to the listed streams while the run is in progress * @defaultValue \{ mode: 'passthrough' \} */ interference?: { mode: 'passthrough'; } | { mode: 'suppress'; streams: ReadonlyArray; }; /** * Whether to print a summary at the end of the test run * @defaultValue false */ summarise?: boolean; /** * Theme for styling the output */ theme?: Theme; } /** * Options for the SummaryPrinter */ export interface SummaryOptions { /** * Whether to include attachments in the summary output * @defaultValue true */ includeAttachments?: boolean; /** * Theme for styling the output */ theme?: Theme; /** * Custom function for formatting code snippets before printing */ formatCode?: FormatCodeFunction; }