jest-bdd-generator
Version:
Jest code generator empowered with Gherkin and BDD
37 lines (36 loc) • 1.47 kB
TypeScript
import type { AggregatedResult, AssertionResult } from '@jest/test-result';
import { runCLI } from 'jest';
import { Step, Result, ExampleStep } from '../types';
type StepWithSanTitle = Step & {
/**
* see: https://github.com/cucumber/cucumber-js/blob/main/docs/custom_snippet_syntaxes.md
*/
sanitizedTitle: string;
};
export declare class DelegateJest {
filename: string;
jestMappedResult: Result[];
constructor(filename: string);
jesting(projects: string[], target?: string): ReturnType<typeof runCLI>;
main(gherkinMap?: Step[]): Promise<AssertionResult[]>;
transformResult(aggregatedResult: AggregatedResult | null, gherkinMap?: Step[]): AssertionResult[];
markStepsStatus(relatedSteps: Result[], status: Result['status']): void;
traceErrorFromMessage(msg: string, step: Step): Result['status'];
sanitizeTitle(title: string, params?: ExampleStep['examples']): {
cucumberStepKey: string;
stepParams?: string[];
};
matchStepName(jestStep: StepWithSanTitle, pickleSteps: {
text: string;
}[], callback: (values: string[], idx: number) => boolean | void): void;
dedupeStepName(dedupe: {
text: string;
step: StepWithSanTitle;
}[]): {
text: string;
step: StepWithSanTitle;
}[];
delegateTo(steps: StepWithSanTitle[]): void;
registerStepDefinition(step: StepWithSanTitle, allSteps: StepWithSanTitle[]): void;
}
export default DelegateJest;