UNPKG

@mmisty/cypress-allure-adapter

Version:

cypress allure adapter to generate allure results during tests execution (Allure TestOps compatible)

100 lines (99 loc) 3.47 kB
/** * Allure Task Client * * Client for communicating with the AllureTaskServer. * Supports both remote (separate process) and local (in-process) modes. */ import type { ServerOperation, OperationResult, FsOperation } from './allure-operations'; /** * Mode for the task client */ export type TaskClientMode = 'local' | 'remote'; /** * Allure Task Client */ export declare class AllureTaskClient { private port; private serverProcess; private isConnected; private startPromise; private mode; private maxRetries; private retryDelay; constructor(mode?: TaskClientMode); getMode(): TaskClientMode; /** * Start the server process (remote mode only) */ start(): Promise<number>; private doStart; /** * Wait for the server to be ready */ waitForReady(): Promise<void>; private killServer; stop(): Promise<void>; getPort(): number | null; /** * Check if the server is healthy and restart if needed */ private ensureServerHealthy; /** * Execute an operation with retry logic */ execute(operation: ServerOperation, retries?: number): Promise<OperationResult>; /** * Check if an error is a connection error that should trigger retry */ private isConnectionError; private executeRemote; /** * Execute operation locally (for local mode) * This imports the server module and executes directly */ private executeLocal; private executeLocalOperation; /** * Execute sync operation locally (no network) */ private executeSyncLocal; /** * Execute sync operation (uses HTTP for remote, direct for local) */ executeSync(operation: FsOperation, retries?: number): OperationResult; mkdir(filePath: string, options?: { recursive?: boolean; }): Promise<void>; mkdirSync(filePath: string, options?: { recursive?: boolean; }): void; writeFile(filePath: string, content: string | Buffer): Promise<void>; appendFile(filePath: string, content: string): Promise<void>; readFile(filePath: string): Promise<Buffer>; copyFile(from: string, to: string, removeSource?: boolean): Promise<void>; removeFile(filePath: string): Promise<void>; removeFileSync(filePath: string): void; exists(filePath: string): Promise<boolean>; existsSync(filePath: string): boolean; attachVideo(allureResults: string, videoPath: string, allureAddVideoOnPass: boolean): Promise<void>; moveToWatch(allureResults: string, allureResultsWatch: string): Promise<void>; attachScreenshots(allureResults: string, screenshots: Array<{ testId: string | undefined; path: string; testAttemptIndex?: number; specName?: string; testFailure?: boolean; }>, allTests: Array<{ specRelative: string | undefined; fullTitle: string; uuid: string; mochaId: string; retryIndex: number | undefined; status?: string; }>): Promise<void>; copyScreenshot(allureResults: string, screenshotPath: string, targetName: string): Promise<void>; writeTestMessage(filePath: string, message: string): Promise<void>; } export declare const getAllureTaskClient: (mode?: TaskClientMode) => AllureTaskClient; export declare const startAllureTaskServer: (mode?: TaskClientMode) => Promise<AllureTaskClient>; export declare const stopAllureTaskServer: () => Promise<void>;