Skip to content

Commit bc82ccc

Browse files
committed
Fix mocking for modules with folders on windows
1 parent e16ce6b commit bc82ccc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/jest-haste-map/src/get_mock_name.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ const MOCKS_PATTERN = path.sep + '__mocks__' + path.sep;
1414

1515
const getMockName = (filePath: string) => {
1616
const mockPath = filePath.split(MOCKS_PATTERN)[1];
17-
return mockPath.substring(0, mockPath.lastIndexOf(path.extname(mockPath)));
17+
return mockPath
18+
.substring(0, mockPath.lastIndexOf(path.extname(mockPath)))
19+
.replace(/\\/g, '/');
1820
};
1921

2022
module.exports = getMockName;

0 commit comments

Comments
 (0)