Skip to content

Commit

Permalink
Fix mocking for modules with folders on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
KELiON committed Aug 10, 2017
1 parent e16ce6b commit bc82ccc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/jest-haste-map/src/get_mock_name.js
Expand Up @@ -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;

0 comments on commit bc82ccc

Please sign in to comment.