/** * In-process shared state between Reporter, Service, and test API. * WDIO Reporter and Service run in the same Node process. * * NOTE: In parallel mode, all state is partitioned by `cid` (capability ID) * so that multiple workers do not overwrite each other's data. */ import type { CtrfAttachment } from './types'; import type { CtrfLogEntry } from './types'; interface PendingTestState { suite: string; test: string; attachments: CtrfAttachment[]; logs: CtrfLogEntry[]; } interface ActiveGlobalHookState { suite: string; hookTitle: string; logs: CtrfLogEntry[]; attachments: CtrfAttachment[]; } /** Bind API calls that do not receive a CID (the exported `ctrf` helper) to * the current WDIO worker. Each WDIO worker has its own process, so this keeps * the existing public API while ensuring reporter and service use one bucket. */ export declare function setCurrentWorkerCid(cid?: string): void; export type HookType = 'before' | 'after' | 'beforeEach' | 'afterEach' | 'unknown'; export declare function setActiveTest(suite: string, test: string, cid?: string): void; export declare function clearActiveTest(cid?: string): { suite: string; test: string; attachments: CtrfAttachment[]; logs: CtrfLogEntry[]; } | null; export declare function getActiveTest(cid?: string): PendingTestState | null; export declare function setActiveGlobalHook(suite: string, hookTitle: string, cid?: string): void; export declare function clearActiveGlobalHook(cid?: string): { suite: string; hookTitle: string; logs: CtrfLogEntry[]; attachments: CtrfAttachment[]; } | null; export declare function getActiveGlobalHook(cid?: string): ActiveGlobalHookState | null; /** * Set (or clear, with `null`) the destination for subsequently emitted logs. * Driven by the reporter at each test/hook boundary. */ export declare function setLogSink(sink: ((entry: CtrfLogEntry) => void) | null, cid?: string): void; /** * Set (or clear, with `null`) the destination for subsequently added attachments. * Driven by the reporter at each test/hook boundary, same as `setLogSink`. */ export declare function setAttachmentSink(sink: ((att: CtrfAttachment) => void) | null, cid?: string): void; export declare function addAttachment(att: CtrfAttachment, cid?: string): void; export declare function addLog(level: string, message: string, cid?: string): void; export declare function pullTestData(suite: string, test: string, cid?: string): { attachments: CtrfAttachment[]; logs: CtrfLogEntry[]; }; export declare function pullGlobalHookLogs(suite: string, hookTitle: string, cid?: string): CtrfLogEntry[]; export declare function pullGlobalHookAttachments(suite: string, hookTitle: string, cid?: string): CtrfAttachment[]; export declare function recordHookFailure(type: HookType, error?: Error, cid?: string): void; export declare function addHookAttachment(type: HookType, att: CtrfAttachment, cid?: string): void; /** Shift (consume) the next recorded failure of the given hook type. */ export declare function takeHookResult(type: HookType, cid?: string): { failed: boolean; message?: string; trace?: string; attachments: CtrfAttachment[]; } | undefined; /** * Shift any recorded hook failure. Used as a last-resort fallback: if the * service captured a hook-failure screenshot but classification did not match * the reporter hook, do not leave that known failure stranded as `passed`. */ export declare function takeAnyHookResult(cid?: string): { failed: boolean; message?: string; trace?: string; attachments: CtrfAttachment[]; } | undefined; export declare function addGlobalAttachment(att: CtrfAttachment, cid?: string): void; export declare function pullGlobalAttachments(cid?: string): CtrfAttachment[]; export declare function clearAll(cid?: string): void; export {}; //# sourceMappingURL=shared-state.d.ts.map