@vlocode/apex
Version:
Salesforce APEX Parser and Grammar
61 lines • 2.53 kB
TypeScript
import { Logger, FileSystem } from '@vlocode/core';
/**
* This class can be used to identify test classes that cover a given Apex class, it
* does so by parsing the source files and identifying test classes.
*
* The class is injectable and depends on the `FileSystem` and `Logger` services. These services can be injected
* by the dependency injection container see {@link container}
*
* @example
* ```typescript
* const testIdentifier = container.create(TestIdentifier);
* await testIdentifier.loadApexClasses([ 'path/to/apex/classes' ]);
* const testClasses = testIdentifier.getTestClasses('MyClass');
* ```
*/
export declare class TestIdentifier {
private fileSystem;
private logger;
/**
* Full path of the file to the apex class name.
*/
private fileToApexClass;
/**
* Map of Apex class information by name class name (lowercase)
*/
private apexClassesByName;
/**
* Set of test class names
*/
private testClasses;
constructor(fileSystem: FileSystem, logger?: Logger);
/**
* Loads the Apex classes from the specified folders and populates the testClasses map.
*
* @param folders - An array of folder paths containing the Apex classes.
* @returns A promise that resolves when the Apex classes are loaded and testClasses map is populated.
*/
loadApexClasses(folders: string[]): Promise<void>;
/**
* Retrieves the test classes that cover a given class, optionally include test classes for classes that reference the given class.
* The depth parameter controls how many levels of references to include, if not specified only direct test classes are returned.
*
* If the class is not found, undefined is returned; if no test classes are found, an empty array is returned.
*
* @param className - The name of the class to retrieve test classes for.
* @param options - Optional parameters for controlling the depth of the search.
* @returns An array of test class names that cover the specified class.
*/
getTestClasses(className: string, options?: {
depth?: number;
}): string[] | undefined;
/**
* Retrieves an Array class that references the given class.
* @param className The name of the class to retrieve references for.
* @returns An array of class names that reference the given class.
*/
private getClassReferences;
private parseSourceFiles;
private readSourceFiles;
}
//# sourceMappingURL=testIdentifier.d.ts.map