Skip to content

Latest commit

 

History

History
248 lines (216 loc) · 6.63 KB

File metadata and controls

248 lines (216 loc) · 6.63 KB

API Report File for "@cucumber/core"

Do not edit this file. It is a report generated by API Extractor.

import type { Argument } from '@cucumber/cucumber-expressions';
import type { CucumberExpression } from '@cucumber/cucumber-expressions';
import type { CucumberExpressionGenerator } from '@cucumber/cucumber-expressions';
import type { Envelope } from '@cucumber/messages';
import type { GherkinDocument } from '@cucumber/messages';
import type { Hook } from '@cucumber/messages';
import type { IdGenerator } from '@cucumber/messages';
import type { NamingStrategy } from '@cucumber/query';
import type { ParameterType } from '@cucumber/messages';
import type parse from '@cucumber/tag-expressions';
import type { Pickle } from '@cucumber/messages';
import type { PickleDocString } from '@cucumber/messages';
import { PickleStep } from '@cucumber/messages';
import type { PickleTable } from '@cucumber/messages';
import type { RegularExpression } from '@cucumber/cucumber-expressions';
import type { Snippet } from '@cucumber/messages';
import type { SourceReference } from '@cucumber/messages';
import type { StepDefinition } from '@cucumber/messages';
import type { TestCase } from '@cucumber/messages';
import type { TestStep } from '@cucumber/messages';

// @public
export class AmbiguousError extends Error {
    constructor(step: AmbiguousStep);
}

// @public
export type AmbiguousStep = {
    type: 'ambiguous';
    pickleStep: PickleStep;
    matches: ReadonlyArray<DefinedStep>;
};

// @public
export interface AssembledTestCase {
    id: string;
    name: string;
    pickleId: string;
    sourceReference: SourceReference;
    testSteps: ReadonlyArray<AssembledTestStep>;
    toMessage(): TestCase;
}

// @public
export interface AssembledTestPlan {
    name?: string;
    testCases: ReadonlyArray<AssembledTestCase>;
    toEnvelopes(): ReadonlyArray<Envelope>;
}

// @public
export interface AssembledTestStep {
    always: boolean;
    id: string;
    name: {
        prefix: string;
        body: string;
    };
    prepare(): PreparedStep | UndefinedStep | AmbiguousStep;
    sourceReference: SourceReference;
    toMessage(): TestStep;
}

// @public
export function buildSupportCode(options?: SupportCodeOptions): SupportCodeBuilder;

// @public
export class DataTable {
    constructor(cells: ReadonlyArray<ReadonlyArray<string>>);
    static from(pickleTable: PickleTable): DataTable;
    hashes(): ReadonlyArray<Record<string, string>>;
    list(): ReadonlyArray<string>;
    raw(): ReadonlyArray<ReadonlyArray<string>>;
    rows(): ReadonlyArray<ReadonlyArray<string>>;
    rowsHash(): Record<string, string>;
    transpose(): DataTable;
}

// @public
export type DefinedParameterType = {
    id: string;
    order: number;
    name: string;
    regularExpressions: ReadonlyArray<string>;
    preferForRegularExpressionMatch: boolean;
    useForSnippets: boolean;
    sourceReference: SourceReference;
    toMessage(): ParameterType;
};

// @public
export type DefinedStep = {
    id: string;
    order: number;
    expression: {
        raw: string | RegExp;
        compiled: CucumberExpression | RegularExpression;
    };
    fn: SupportCodeFunction;
    sourceReference: SourceReference;
    toMessage(): StepDefinition;
};

// @public
export type DefinedTestCaseHook = {
    id: string;
    order: number;
    name?: string;
    tags?: {
        raw: string;
        compiled: ReturnType<typeof parse>;
    };
    fn: SupportCodeFunction;
    sourceReference: SourceReference;
    toMessage(): Hook;
};

// @public
export type DefinedTestRunHook = {
    id: string;
    order: number;
    name?: string;
    fn: SupportCodeFunction;
    sourceReference: SourceReference;
    toMessage(): Hook;
};

// @public
export function makeTestPlan(ingredients: TestPlanIngredients, options?: TestPlanOptions): AssembledTestPlan;

// @public
export type MatchedStep = {
    def: DefinedStep;
    args: ReadonlyArray<Argument>;
};

// @public
export interface NewParameterType {
    name: string;
    preferForRegexpMatch?: boolean;
    regexp: RegExp | string | readonly RegExp[] | readonly string[];
    sourceReference: SourceReference;
    transformer?: (...match: string[]) => unknown;
    useForSnippets?: boolean;
}

// @public
export interface NewStep {
    fn: SupportCodeFunction;
    pattern: string | RegExp;
    sourceReference: SourceReference;
}

// @public
export interface NewTestCaseHook {
    fn: SupportCodeFunction;
    name?: string;
    sourceReference: SourceReference;
    tags?: string;
}

// @public
export interface NewTestRunHook {
    fn: SupportCodeFunction;
    name?: string;
    sourceReference: SourceReference;
}

// @public
export type PreparedStep = {
    type: 'prepared';
    fn: SupportCodeFunction;
    args: ReadonlyArray<Argument>;
    dataTable?: PickleTable;
    docString?: PickleDocString;
};

// @public
export interface SupportCodeBuilder {
    afterAllHook(options: NewTestRunHook): SupportCodeBuilder;
    afterHook(options: NewTestCaseHook): SupportCodeBuilder;
    beforeAllHook(options: NewTestRunHook): SupportCodeBuilder;
    beforeHook(options: NewTestCaseHook): SupportCodeBuilder;
    build(): SupportCodeLibrary;
    parameterType(options: NewParameterType): SupportCodeBuilder;
    step(options: NewStep): SupportCodeBuilder;
}

// @public
export type SupportCodeFunction = (...args: any[]) => any | Promise<any>;

// @public
export interface SupportCodeLibrary {
    findAllAfterHooksBy(tags: ReadonlyArray<string>): ReadonlyArray<DefinedTestCaseHook>;
    findAllBeforeHooksBy(tags: ReadonlyArray<string>): ReadonlyArray<DefinedTestCaseHook>;
    findAllStepsBy(text: string): ReadonlyArray<MatchedStep>;
    getAllAfterAllHooks(): ReadonlyArray<DefinedTestRunHook>;
    getAllBeforeAllHooks(): ReadonlyArray<DefinedTestRunHook>;
    getAllSources(): ReadonlyArray<SourceReference>;
    getExpressionGenerator(): CucumberExpressionGenerator;
    toEnvelopes(): ReadonlyArray<Envelope>;
}

// @public
export interface SupportCodeOptions {
    newId?: IdGenerator.NewId;
}

// @public
export interface TestPlanIngredients {
    gherkinDocument: GherkinDocument;
    pickles: ReadonlyArray<Pickle>;
    supportCodeLibrary: SupportCodeLibrary;
    testRunStartedId?: string;
}

// @public
export interface TestPlanOptions {
    newId?: IdGenerator.NewId;
    strategy?: NamingStrategy;
}

// @public
export class UndefinedError extends Error {
    constructor(step: UndefinedStep, snippets?: ReadonlyArray<Snippet>);
}

// @public
export type UndefinedParameterType = {
    name: string;
    expression: string;
};

// @public
export type UndefinedStep = {
    type: 'undefined';
    pickleStep: PickleStep;
};

// (No @packageDocumentation comment for this package)