import type { AfterCommandArgs, BeforeCommandArgs, ContextEnd, HookStats, RunnerStats, SuiteStats, TestStats } from '@wdio/reporter'; import WDIOReporter from '@wdio/reporter'; import type { Status as AllureStatus } from 'allure-js-commons'; import { AllureReportState } from './state.js'; import type { AllureReporterOptions } from './types.js'; import * as AllureApi from './common/api.js'; type StepAttachment = { content: string | Buffer; name?: string; type?: string; }; type StepPayload = { title?: string; attachment?: StepAttachment; status?: AllureStatus; }; type StepWrapper = { step: StepPayload; }; export default class AllureReporter extends WDIOReporter { private _allureRuntime; private _capabilities; private _isMultiRemote?; private _config?; private _options; private _consoleOutput; private _originalStdoutWrite; private _isFlushing; private _flushChain; private _pendingFlushes; private _cid?; private _testPlan; private _suiteStartedDepthByCid; private _currentLeafTitleByCid; private _tpSkipByCid; private _linkTemplates?; private _suiteStackByCid; private _suiteStack; private _pkgByCid; private _titlePathFileByCid; private _cukeScenarioActiveByCid; private _laneMode; /** the framework of the run, from its name in any case or its scoped package; `undefined` when not known */ private _framework?; private _lanesSeen; private _lanes; private _closedLaneKeys; allureStatesByCid: Map; private static getTimeOrNow; get isSynchronised(): boolean; constructor(options: AllureReporterOptions); private _ensureState; private _laneKey; private _lane; private _openLane; private _pushRuntimeMessage; /** * In parallel mode every suite:end comes after the last test and its hooks, so a lane * that no context:end closed (older framework) closes there, with its after hooks */ private _closeEndedLanes; /** * A parallel test's messages are replayed into the shared state in one piece, wrapped in a * suite of their own, so the sequential state never sees two tests interleaved. */ private _closeLane; private _leaveTail; private _suitePathOf; /** the feature of a parallel Cucumber unit: parallel mode starts every feature first */ private _unitFeature; /** the spec file of the unit, else the one that started last */ private _pkg; /** the state of a Cucumber scenario in a parallel unit; `undefined` in a sequential run */ private _cukeUnit; private _cukeScenarioActive; private _setCukeScenarioActive; private _activeSuitePath; private _attachFile; private _currentCid; private _attachLogs; private _attachJSON; private _attachScreenshot; private _handleCucumberStepStart; private _handleCucumberStepEnd; private _startSuite; private _endSuite; /** * Write out everything buffered so far without finalising the run, so results of * completed tests reach the results directory while the run is still going. Flushes are * chained so they cannot overlap. */ private _flushIncrementally; private _beginFlush; private _endFlush; private _startTest; private _endTest; private _skipTest; private _startStep; private _endStep; private _startHook; private _endHook; /** * Stable key from current capabilities for historyId. * Uses the browser/device family by default so history survives version bumps. * Must NOT include cid. Used to make historyId unique per environment. */ private _getCapabilityKey; /** * Emits historyId (and testCaseId) from full title and capability key (browser/device from test run). * Must NOT include cid or file path: cid varies between runs; user asked for no filesystem. */ private _emitHistoryIdsFrom; private _setTestParameters; private _registerListeners; onRunnerStart(runner: RunnerStats): void; onRunnerEnd(_runner: RunnerStats): Promise; onSuiteStart(suite: SuiteStats & { start: Date; }): void; onSuiteEnd(suite: SuiteStats & { end: Date; }): void; onSuiteRetry(suite: SuiteStats): void; private _inCucumberStepMode; onTestStart(test: TestStats | HookStats): void; onTestPass(test: TestStats | HookStats): void; onTestRetry(test: TestStats): void; onTestFail(test: TestStats | HookStats): void; onTestPending(test: TestStats): void; onTestSkip(test: TestStats): void; onBeforeCommand(command: BeforeCommandArgs): void; onAfterCommand(command: AfterCommandArgs): void; onTestEnd(test: TestStats): void; onContextEnd(payload: ContextEnd): void; onHookStart(hook: HookStats): void; onHookEnd(hook: HookStats): void; private get _hasPendingTest(); private get _hasPendingHook(); private _isOpenInLane; private _tpActive; private _ensureSuitesStarted; private _emitBaseLabels; private _isCucumberSuiteLike; private _isCucumberHook; private _decideCucumberSkipForHook; private _tpSkipActive; private _setTpSkip; private _decideCucumberSkip; private _mochaFullTitle; /** * Full title for a synthetic hook-failure result. A hook can fire before any * test sets the lane's suite path (parallel mode), so `_activeSuitePath` * contributes nothing there and hooks with the same title in different * suites would share one history id. `pathOf` reads the base reporter's suite * tree, which links every hook to its declaring suite, so the id no longer * depends on which lane happened to be open. * * A root all-hook has no owning suite, so its path stays empty and the id is * the same in sequential and parallel mode. A failed each-hook is reported * once per test with the same title in parallel mode, so the test title joins * the hash; otherwise Allure would read those failures as retries of one * result. */ private _hookFullTitle; private _titlePath; private _hookType; private _isAfterHook; private _hookScope; private _deriveHookType; private _formatLink; private _md5; addLabel({ name, value }: { name: string; value: string; }): void; addStory({ storyName }: { storyName: string; }): void; addFeature({ featureName }: { featureName: string; }): void; addSeverity({ severity }: { severity: string; }): void; addEpic({ epicName }: { epicName: string; }): void; addOwner({ owner }: { owner: string; }): void; addSuite({ suiteName }: { suiteName: string; }): void; addParentSuite({ suiteName }: { suiteName: string; }): void; addSubSuite({ suiteName }: { suiteName: string; }): void; addTag({ tag }: { tag: string; }): void; addIssue({ issue }: { issue: string; }): void; addTestId({ testId }: { testId: string; }): void; addAllureId({ id }: { id: string; }): void; addDescription(args: { description: string; descriptionType?: number | 'html' | 'markdown'; }): void; addAttachment(args: { name: string; content: string | Buffer | object; type?: string; }): void; addArgument({ name, value, mode, excluded }: { name: string; value: string; mode?: 'masked' | 'hidden' | 'default'; excluded?: boolean; }): void; startStep(title: string): void; endStep(status: AllureStatus): void; addStep(title: string, payload: StepWrapper): void; addStep(payload: StepPayload): void; addStep(payload: StepWrapper): void; static addFeature: typeof AllureApi.addFeature; static addLink: typeof AllureApi.addLink; static addEpic: typeof AllureApi.addEpic; static addOwner: typeof AllureApi.addOwner; static addTag: typeof AllureApi.addTag; static addLabel: typeof AllureApi.addLabel; static addSeverity: typeof AllureApi.addSeverity; static addIssue: typeof AllureApi.addIssue; static addSuite: typeof AllureApi.addSuite; static addSubSuite: typeof AllureApi.addSubSuite; static addParentSuite: typeof AllureApi.addParentSuite; static addTestId: typeof AllureApi.addTestId; static addStory: typeof AllureApi.addStory; static addDescription: typeof AllureApi.addDescription; static addAttachment: typeof AllureApi.addAttachment; static startStep: typeof AllureApi.startStep; static endStep: typeof AllureApi.endStep; static addStep: typeof AllureApi.addStep; static addArgument: typeof AllureApi.addArgument; static addAllureId: typeof AllureApi.addAllureId; static step: typeof AllureApi.step; } export {}; //# sourceMappingURL=reporter.d.ts.map