From bc82cccc76e25017570ea1d684a842c09359222e Mon Sep 17 00:00:00 2001 From: Alexandr Subbotin Date: Thu, 10 Aug 2017 15:54:59 +0200 Subject: [PATCH] Fix mocking for modules with folders on windows --- packages/jest-haste-map/src/get_mock_name.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/jest-haste-map/src/get_mock_name.js b/packages/jest-haste-map/src/get_mock_name.js index 7ca2b9b5db67..650f29e7a393 100644 --- a/packages/jest-haste-map/src/get_mock_name.js +++ b/packages/jest-haste-map/src/get_mock_name.js @@ -14,7 +14,9 @@ const MOCKS_PATTERN = path.sep + '__mocks__' + path.sep; const getMockName = (filePath: string) => { const mockPath = filePath.split(MOCKS_PATTERN)[1]; - return mockPath.substring(0, mockPath.lastIndexOf(path.extname(mockPath))); + return mockPath + .substring(0, mockPath.lastIndexOf(path.extname(mockPath))) + .replace(/\\/g, '/'); }; module.exports = getMockName;