/** * CTRF Cypress Node Plugin * * This module runs in the Cypress node process and: * 1. Registers a task handler to receive runtime messages from browser * 2. Stores runtime metadata keyed by test identity * 3. Provides access to stored data for the reporter to merge * * ## Setup * * In your cypress.config.ts: * ```ts * import { setupCtrfPlugin, getCtrfRuntimeStore } from 'cypress-ctrf-json-reporter/plugin' * * export default defineConfig({ * e2e: { * setupNodeEvents(on, config) { * setupCtrfPlugin(on) * // ... other plugins * return config * } * } * }) * ``` */ import type { CtrfCypressMessage } from './runtime'; type CypressPluginEvents = { (action: 'task', tasks: Record any>): void; }; export declare const CTRF_TASK_NAME = "__ctrf_runtime_message"; /** * Store for runtime data, keyed by testKey (specRel::fullTitle::attemptIndex) */ declare class CtrfRuntimeStore { private data; /** * Store a runtime message for a test */ addMessage(message: CtrfCypressMessage): void; /** * Deep merge two objects following CTRF merge rules: * - Arrays: concatenated * - Objects: recursively merged * - Primitives: overwritten */ private deepMerge; /** * Get merged runtime data for a test key */ getMerged(testKey: string): Record | null; /** * Get merged runtime data by matching spec and test title * This is used by the reporter which has spec.relative and test.title array */ getByTestIdentity(specRelative: string, titleArray: string[], attemptIndex: number): Record | null; /** * Clear all stored data for a spec (called after spec completes) */ clearSpec(specRelative: string): void; /** * Clear all stored data (called at end of run) */ clearAll(): void; /** * Get all keys (for debugging) */ getAllKeys(): string[]; } /** * Get the runtime store instance (for use by reporter) */ export declare function getCtrfRuntimeStore(): CtrfRuntimeStore; /** * Setup the CTRF plugin in Cypress node events. * * @param on - The Cypress `on` function from setupNodeEvents * * @example * ```ts * setupNodeEvents(on, config) { * setupCtrfPlugin(on) * return config * } * ``` */ export declare function setupCtrfPlugin(on: CypressPluginEvents): void; /** * Create a combined plugin setup that includes the CTRF reporter. * Use this if you want an all-in-one setup. * * @param on - The Cypress `on` function * @param reporterOptions - Options for the CTRF reporter */ export declare function setupCtrfReporterWithRuntime(on: CypressPluginEvents, reporterOptions?: Record): void; export {};