UNPKG

jest-bdd-generator

Version:

Jest code generator empowered with Gherkin and BDD

47 lines (46 loc) 1.88 kB
import * as ts from 'typescript'; import { IStepKey, Step } from '../types'; export type ICallbackOnFunctionExpression = (node: ts.Expression, callExpression: ts.CallExpression, context: IArgumentsSearchContext, ..._any: unknown[]) => void; export type IArgumentsSearchContext = { host: string; stepOfCurrentFunction: Step; }; export type ISearchExpressionSchema = { keyword: string; arguments: { callback?: ICallbackOnFunctionExpression; searchCallSchema?: ISearchCallSchema; }[]; chain?: ISearchCallSchema; }; export type ISearchCallSchema = Array<ISearchExpressionSchema>; export declare const customTransformerFactory: (searchSchema: ISearchCallSchema, self: Transpile) => ts.CustomTransformerFactory; export declare class Transpile { searchSchema: ISearchCallSchema; source: string; sourceFile?: ts.SourceFile; output: Step[]; get steps(): Step[]; get uniqueSteps(): Step[]; possibleStep: Step[]; set input(input: string); get input(): string; constructor(searchSchema?: ISearchCallSchema); parsePosition(pos: number): Step['pos']['start']; groupToScenario(): void; getDeclaration(declaration: ts.VariableDeclaration | ts.BindingElement): string[]; generateComments(): string; generateFromKnownSteps(block: ts.Block): Transpile['output']; getComments(block: ts.Block, _lastItem?: Step): Transpile['output']; /** * * @param name Gherkin Keyword, Feature or Scenario * @returns the retrieved step */ callbackOnStringArgumentFactory: (name: IStepKey) => ICallbackOnFunctionExpression; callbackOnFnArgument: ICallbackOnFunctionExpression; dealwithSourceMap(input: string): Record<string, string>; transpile(input: string, options?: ts.TranspileOptions): ts.TranspileOutput; private _prepareOutput; outputCode(): string; }