@workday/canvas-kit-docs
Version:
Documentation components of Canvas Kit components
24 lines • 990 B
TypeScript
export interface DescribeBlock {
type: 'describe';
name: string;
children: (DescribeBlock | ItBlock)[];
}
export interface ItBlock {
type: 'it';
name: string;
}
export interface FileBlock {
type: 'file';
name: string;
children: (DescribeBlock | ItBlock)[];
}
/**
* Reads a spec file by getting the file contents as a string, passing through the TypeScript
* transpiler, setting up custom `describe`, `it`, `beforeEach`, etc functions and runs the file
* contents through `eval()` with those custom functions to extract out a JSON object representing
* the structure of a Spec file. We use `eval` instead of an AST parser to handle meta coding like
* `[a, b].forEach(() => { it('...') })`. Running the contents through a JavaScript context means
* the file contents can be extracted via any runtime tricks used in spec files.
*/
export declare function parseSpecFile(file: string): Promise<FileBlock | null>;
//# sourceMappingURL=parseSpecFile.d.ts.map