MCPcopy
hub / github.com/jestjs/jest / replaceRootDirInPath

Function replaceRootDirInPath

packages/jest-config/src/utils.ts:57–69  ·  view source on GitHub ↗
(
  rootDir: string,
  filePath: string,
)

Source from the content-addressed store, hash-verified

55 path.replaceAll(/([!()*?[\\\]{}])/g, '\\$1');
56
57export 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
71const _replaceRootDirInObject = <T extends ReplaceRootDirConfigObj>(
72 rootDir: string,

Callers 7

setupPresetFunction · 0.90
normalizeReportersFunction · 0.90
normalizeFunction · 0.90
readInitialOptionsFunction · 0.90
findRelatedTestsMethod · 0.90
resolveFunction · 0.70
_replaceRootDirTagsFunction · 0.70

Calls 1

resolveMethod · 0.45

Tested by

no test coverage detected