( rootDir: string, filePath: string, )
| 55 | path.replaceAll(/([!()*?[\\\]{}])/g, '\\$1'); |
| 56 | |
| 57 | export const replaceRootDirInPath = ( |
| 58 | rootDir: string, |
| 59 | filePath: string, |
| 60 | ): string => { |
| 61 | if (!filePath.startsWith('<rootDir>')) { |
| 62 | return filePath; |
| 63 | } |
| 64 | |
| 65 | return path.resolve( |
| 66 | rootDir, |
| 67 | path.normalize(`./${filePath.slice('<rootDir>'.length)}`), |
| 68 | ); |
| 69 | }; |
| 70 | |
| 71 | const _replaceRootDirInObject = <T extends ReplaceRootDirConfigObj>( |
| 72 | rootDir: string, |
no test coverage detected