/** * CTRF Runtime API for Cypress * * Enables enriching CTRF test reports with custom metadata at runtime. * Metadata is collected via cy.task and consolidated by the reporter * into the test's `extra` field. * * ## Usage * * ```ts * import { ctrf } from 'cypress-ctrf-json-reporter/runtime' * * it('checkout flow', () => { * ctrf.extra({ owner: 'checkout-team', priority: 'P1' }) * // ... test code * ctrf.extra({ customMetric: 'value' }) * }) * ``` * * ## API * * - `ctrf.extra(data)` - Attach key-value metadata to the current test * * ## Behavior * * - Call multiple times; all data is collected and merged * - Works from any function in the call stack during test execution * - Silently ignored when called outside test context * - Deep merge: arrays concatenated, objects recursively merged, primitives overwritten */ /** * Runtime message format sent from browser to node plugin. */ export interface CtrfCypressMessage { type: 'metadata'; testKey: string; data: Record; } /** * Transport interface for sending metadata to the node plugin. * The browser adapter will set this up. */ export interface CtrfTransport { send(message: CtrfCypressMessage): void; } /** * Register a transport (called by the browser adapter during Cypress setup). * @internal */ export declare function __registerTransport(transport: CtrfTransport): void; /** * Unregister the transport (for cleanup/testing). * @internal */ export declare function __clearTransport(): void; /** * Get the current test key from Mocha/Cypress context. * Returns null if not in a test context. * @internal */ export declare function __getCurrentTestKey(): string | null; /** * Attach custom metadata to the current test. * * @param data - Key-value pairs to include in the CTRF report's `extra` field * * @remarks * - Multiple calls accumulate; data is deep-merged (arrays concatenated, objects recursed, primitives overwritten) * - Safe to call from helper functions - binds to the active test automatically * - No-op outside test context (e.g., in hooks without a test) * * @example * ctrf.extra({ owner: 'platform-team' }) * ctrf.extra({ executionId: 'abc123', retryable: true }) */ export declare function extra(data: Record): void; /** CTRF runtime API namespace */ export declare const ctrf: { readonly extra: typeof extra; };