jest-codemods
Version:
Codemods for migrating test files to Jest
25 lines (24 loc) • 1.26 kB
TypeScript
export declare function addRequireOrImport(j: any, ast: any, localName: string, pkg: string): void;
export declare function addRequireOrImportOnceFactory(j: any, ast: any): (localName: any, pkg: any) => void;
export declare function findRequires(j: any, ast: any, pkg: string): any;
export declare function findImports(j: any, ast: any, pkg: any): any;
/**
* Detects CommonJS and import statements for the given package.
* @return true if import were found, else false
*/
export declare function hasRequireOrImport(j: any, ast: any, pkg: string): boolean;
/**
* Returns localName for any CommonJS or import statements for the given package.
* @return string if import were found, else undefined
*/
export declare function getRequireOrImportName(j: any, ast: any, pkg: string): any;
/**
* Detects and removes default import statements for given package.
* @return the local name for the default import or null
*/
export declare function removeDefaultImport(j: any, ast: any, pkg: string): any;
/**
* Detects and removes CommonJS and import statements for given package.
* @return the import variable name or null if no import were found.
*/
export declare function removeRequireAndImport(j: any, ast: any, pkg: string, specifier?: string): any;