@cucumber/cucumber
    Preparing search index...

    Type Alias FormatterPluginContext<OptionsType>

    Context object passed to a formatter plugin's function

    type FormatterPluginContext<OptionsType> = {
        directory?: string;
        logger: ILogger;
        on: (key: "message", handler: (value: Envelope) => void) => void;
        options: OptionsType;
        stream: NodeJS.WritableStream;
        write: (buffer: string | Uint8Array) => void;
    }

    Type Parameters

    • OptionsType
    Index

    Properties

    directory?: string

    The directory containing the target file, if the output stream is for a file

    This can be used to write additional files as siblings to the output file, but this should be for exceptional cases; we recommend keeping formatter output self-contained as much as possible.

    logger: ILogger

    Logger for emitting user-facing messages or diagnostics; goes to stderr

    on: (key: "message", handler: (value: Envelope) => void) => void

    Register a handler for Cucumber Messages

    options: OptionsType

    Options for the formatter

    If the plugin definition provides an optionsKey, this value will be from that key in the global options object. Otherwise, it will be the entire global options object.

    stream: NodeJS.WritableStream

    The writable stream the output is being written to

    Ideally you should use this only for feature detection and/or advanced TTY functionality; for just writing output, use write

    write: (buffer: string | Uint8Array) => void

    Fire-and-forget function to write data to the output stream