UNPKG

@amiceli/vitest-cucumber

Version:

vitest tools to use Gherkin feature in unit tests

59 lines (58 loc) 2.06 kB
import type { RequiredVitestCucumberOptions, VitestCucumberOptions } from '../vitest/configuration'; import { Background } from './models/Background'; import { Rule } from './models/Rule'; import type { StepAble } from './models/Stepable'; import { Feature } from './models/feature'; export type ParserOptions = Pick<VitestCucumberOptions, 'language'>; export type RequiredParserOptions = Pick<RequiredVitestCucumberOptions, 'language'>; declare enum FeatureActions { FEATURE = "Feature", SCENARIO = "Scenario", BACKGROUND = "Background", STEP = "Step", RULE = "Rule", EXAMPLES = "Examples" } export declare class GherkinParser { private readonly spokenParser; readonly features: Feature[]; private currentFeatureIndex; private currentScenarioIndex; private currentRulenIndex; private lastScenarioOutline; private currentExample; private currentExampleLine; private exampleKeys; private currentDataTable; private currentStepDataTableLine; private dataTanleKeys; private lastTags; private lastSteppableTag; private readonly currentDocStrings; private parsingDocStrings; private previousAction; private lastStep; private resetStepDataTable; constructor(options: RequiredParserOptions); hasFeature(line: string): boolean; hasSteppable(line: string): boolean; hasScenarioOutline(line: string): boolean; previousActionIs(value: FeatureActions): boolean; addLine(line: string): void; private addBackgroundToParent; private addScenarioToParent; finish(): Feature[]; private getVariablesFromLine; private getObjectWithValuesFromLine; private addTagToParent; private getEmptyExamplesValues; private detectMissingExamplesKeyword; private updateStepDataTable; private updateScenarioExamples; isDocStrings(line: string): boolean; get currentBackground(): Background | null; get currentRule(): Rule | undefined; get currentFeature(): Feature; get currentScenario(): StepAble; } export {};