Skip to content

Commit

Permalink
Fix mocking for modules with folders on windows (#4238)
Browse files Browse the repository at this point in the history
  • Loading branch information
KELiON authored and cpojer committed Aug 10, 2017
1 parent 5e144b1 commit 01d5d69
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
Original file line number Diff line number Diff line change
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 01d5d69

Please sign in to comment.