/** * CTRF Runtime API for Mocha * * The reporter sets a global runtime interface that forwards metadata to the reporter. * * ## Usage * * ```ts * import { extra } from 'mocha-ctrf-json-reporter/runtime' * * it('should do something', () => { * extra({ priority: 'high', owner: 'team-a' }) * // test code... * }) * ``` */ declare const CTRF_MOCHA_RUNTIME_KEY = "__ctrfMochaRuntime__"; type MessageProcessor = (message: RuntimeMessage) => void; interface RuntimeMessage { type: "extra"; data: Record; } /** * MochaTestRuntime interface for type exports */ interface MochaTestRuntime { extra(data: Record): void; } /** * Set the global runtime (called by reporter) */ declare function setGlobalTestRuntime(runtime: MochaTestRuntime): void; /** * Create a runtime instance with a message processor */ declare function createTestRuntime(messageProcessor: MessageProcessor): MochaTestRuntime; /** * Add extra data to the current test's CTRF output. * Call this from within test code to attach custom metadata. * * @example * ```ts * import { extra } from 'mocha-ctrf-json-reporter/runtime' * * it('should do something', () => { * extra({ priority: 'high', owner: 'team-a' }) * // test code... * }) * ``` * * Multiple calls are deep-merged: * - Arrays are concatenated * - Nested objects are recursively merged * - Primitives are overwritten by later calls */ declare function extra(data: Record): void; /** CTRF runtime API namespace */ declare const ctrf: { readonly extra: typeof extra; }; export { CTRF_MOCHA_RUNTIME_KEY, type MessageProcessor, type MochaTestRuntime, type RuntimeMessage, createTestRuntime, ctrf, extra, setGlobalTestRuntime };