UNPKG

jest-codemods

Version:

Codemods for migrating test files to Jest

32 lines (31 loc) 1.07 kB
/** * Rewrites CallExpression by: * - removing 't.pass' calls * - 't.end' calls are possible remove or renamed to 'done' * - 't.fail' calls are changed to 'done.fail' * * @param {jscodeshift} j * @param {CallExpression} path of test function */ export declare function rewriteAssertionsAndTestArgument(j: any, path: any): void; /** * Rewrite test callback to be able to destructure its argument * * test(({ok}) => {ok()}) to test(t => {ok()}) */ export declare function rewriteDestructuredTArgument(fileInfo: any, j: any, ast: any, testFunctionName: any): void; /** * Rewrite Execution reference name if not 't' * * @param fileInfo * @param {jscodeshift} j * @param {Collection} ast * @param {string} testFunctionName */ export declare function renameExecutionInterface(fileInfo: any, j: any, ast: any, testFunctionName: any): void; /** * Validated that "t" is the test argument name. * * Example: 'test(x => {})' gives a warning. */ export declare function detectUnsupportedNaming(fileInfo: any, j: any, ast: any, testFunctionName: any): void;