UNPKG

allure-js-commons

Version:
67 lines (66 loc) • 3.94 kB
import type { ErrorStatus, FixtureResult, GlobalErrorArgs, Label, Link, StatusDetails, StepResult, TestResult } from "../model.js"; import { LabelName, Status } from "../model.js"; import type { RuntimeGlobalAttachmentContentMessage, RuntimeGlobalAttachmentPathMessage, RuntimeGlobalErrorMessage, RuntimeMetricResultMessage, RuntimeMessage, SerializeOptions, SerializerReplacerFunc } from "./types.js"; export declare const getStatusFromError: (error: unknown) => ErrorStatus; /** * https://github.com/chalk/strip-ansi */ export declare const stripAnsi: (str: string) => string; /** Extract error details, optionally using an adapter-specific serializer for assertion values. */ export declare const getMessageAndTraceFromError: (error: Error | { message?: string; stack?: string; }, serializeValue?: (value: unknown) => string) => StatusDetails; /** * Normalize global errors before transport, while non-enumerable error properties * and assertion metadata are still available for extraction and classification. * * @param {GlobalErrorArgs} args - Error details, or an explicit status and optional details. * @returns {StatusDetails & { status: ErrorStatus }} Serialized details with the explicit or inferred status. */ export declare const getGlobalErrorDetails: (...[status, details]: GlobalErrorArgs) => StatusDetails & { status: ErrorStatus; }; export declare const toGlobalErrorMessage: ({ name, details, status, }: { name: string; details: StatusDetails; status: Status; }) => RuntimeGlobalErrorMessage; type AllureTitleMetadataMatch = RegExpMatchArray & { groups: { type?: string; v1?: string; v2?: string; v3?: string; v4?: string; }; }; export declare const allureMetadataRegexp: RegExp; export declare const allureTitleMetadataRegexp: RegExp; export declare const allureTitleMetadataRegexpGlobal: RegExp; export declare const allureIdRegexp: RegExp; export declare const allureLabelRegexp: RegExp; export declare const getTypeFromAllureTitleMetadataMatch: (match: AllureTitleMetadataMatch) => string; export declare const getValueFromAllureTitleMetadataMatch: (match: AllureTitleMetadataMatch) => string; export declare const isMetadataTag: (tag: string) => boolean; export declare const getMetadataLabel: (tag: string, value?: string) => Label | undefined; export declare const extractMetadataFromString: (title: string) => { labels: Label[]; links: Link[]; cleanTitle: string; }; export declare const isAnyStepFailed: (item: StepResult | TestResult | FixtureResult) => boolean; export declare const isAllStepsEnded: (item: StepResult | TestResult | FixtureResult) => boolean; export declare const hasLabel: (testResult: TestResult, labelName: LabelName | string) => boolean; export declare const hasStepMessage: (messages: RuntimeMessage[]) => boolean; export declare const isGlobalRuntimeMessage: (message: RuntimeMessage) => message is RuntimeGlobalAttachmentContentMessage | RuntimeGlobalAttachmentPathMessage | RuntimeGlobalErrorMessage | RuntimeMetricResultMessage; export declare const getStepsMessagesPair: (messages: RuntimeMessage[]) => RuntimeMessage[][]; export declare const getUnfinishedStepsMessages: (messages: RuntimeMessage[]) => RuntimeMessage[][]; export declare const isPromise: <T = any>(obj: any) => obj is PromiseLike<T>; export declare const serialize: (value: any, { maxDepth, maxLength, replacer }?: SerializeOptions) => string; export declare const composeReplacers: (first: SerializerReplacerFunc, second: SerializerReplacerFunc) => SerializerReplacerFunc; export declare const excludeCircularRefsFromMap: (parents: any[], map: Map<any, any>) => any[][]; export declare const excludeCircularRefsFromSet: (parents: any[], set: Set<any>) => any[]; export declare const limitString: (value: string, maxLength: number) => string; export declare const uint8ArrayToBase64: (data: Uint8Array) => string; export {};