@moonwall/cli
Version:
Testing framework for the Moon family of projects
34 lines (33 loc) • 1.39 kB
TypeScript
export interface TestIds {
suiteId: string | undefined;
testIds: string[];
}
/**
* Extracts suite and test IDs from a Moonwall test file using AST parsing.
* This is more robust than regex as it handles comments, multiline formatting, etc.
*/
export declare function extractTestIds(fileContent: string): TestIds;
/**
* Replaces the suite ID in a Moonwall test file.
* Returns the modified file content, or undefined if no describeSuite was found.
*/
export declare function replaceSuiteId(fileContent: string, newId: string): string | undefined;
/**
* Checks if a file contains a describeSuite call (is a Moonwall test file).
*/
export declare function hasSuiteDefinition(fileContent: string): boolean;
export interface MatchedTestFile {
filePath: string;
suiteId: string;
testIds: string[];
}
/**
* Finds all test files matching the pattern using ast-grep's parallel file search.
* Uses Rust threads for efficient parsing and searching.
*
* @param testDirs - Directories to search for test files
* @param includeGlobs - Glob patterns for files to include (e.g., ["*test*.ts", "*spec*.ts"])
* @param idPattern - Regex pattern to match against suite/test IDs
* @returns Promise resolving to array of matching file paths
*/
export declare function findTestFilesMatchingPattern(testDirs: string[], includeGlobs: string[], idPattern: RegExp): Promise<string[]>;