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

Function getMockName

packages/jest-haste-map/src/getMockName.ts:12–17  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

10const MOCKS_PATTERN = `${path.sep}__mocks__${path.sep}`;
11
12const getMockName = (filePath: string): string => {
13 const mockPath = filePath.split(MOCKS_PATTERN)[1];
14 return mockPath
15 .slice(0, mockPath.lastIndexOf(path.extname(mockPath)))
16 .replaceAll('\\', '/');
17};
18
19export default getMockName;

Callers 3

_processFileMethod · 0.85
onChangeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected