import { Attachment, TestResultType } from '../models'; import { LoggerInterface } from '../utils/logger'; export interface InternalReporterInterface { addTestResult(result: TestResultType): Promise; publish(): Promise; startTestRun(): Promise; getTestResults(): TestResultType[]; setTestResults(results: TestResultType[]): void; sendResults(): Promise; complete(): Promise; uploadAttachment(attachments: Attachment): Promise; } /** * @abstract * @class AbstractReporter * @implements InternalReporterInterface */ export declare abstract class AbstractReporter implements InternalReporterInterface { /** * @type {LoggerInterface} * @private */ protected readonly logger: LoggerInterface; /** * @type {TestResultType[]} * @protected */ protected results: TestResultType[]; /** * Every result id handed out so far. The id doubles as the idempotency key of the v2 results * API, so a framework that reuses its own identifiers (Newman replays the same item id on * every iteration) must not be allowed to collapse two distinct results into one. * * @type {Set} * @private */ private readonly seenResultIds; /** * @returns {Promise} */ abstract publish(): Promise; /** * @returns {Promise} */ abstract startTestRun(): Promise; /** * @returns {Promise} */ abstract complete(): Promise; /** * @returns {Promise} */ abstract sendResults(): Promise; /** * @param {Attachment} attachment * @returns {Promise} */ abstract uploadAttachment(attachment: Attachment): Promise; /** * @protected * @param {LoggerInterface} logger */ protected constructor(logger: LoggerInterface); /** * @returns {TestResultType[]} */ getTestResults(): TestResultType[]; /** * @param {TestResultType} result */ addTestResult(result: TestResultType): Promise; /** * @param {TestResultType[]} results */ setTestResults(results: TestResultType[]): void; /** * Guarantees `result.id` is set and unique within this reporter. A missing or reused id would * either let the backend invent a fresh idempotency key on every attempt (duplicates on * retry) or merge two distinct results into one (silent loss). * * @param {TestResultType} result * @private */ private ensureUniqueId; protected removeAnsiEscapeCodes(str: string): string; }