Skip to content

Commit 1c1c958

Browse files
committed
Fix haste_impl for windows
1 parent 92c5e04 commit 1c1c958

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

packages/jest-haste-map/src/__tests__/haste_impl.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,21 @@
66
*/
77
'use strict';
88

9+
const path = require('path');
10+
911
module.exports = {
10-
getHasteName(path) {
12+
getHasteName(filename) {
1113
if (
12-
path.includes('__mocks__') ||
13-
path.includes('NoHaste') ||
14-
path.includes('/module_dir/') ||
15-
path.includes('/sourcemaps/')
14+
filename.includes('__mocks__') ||
15+
filename.includes('NoHaste') ||
16+
filename.includes(path.sep + 'module_dir' + path.sep) ||
17+
filename.includes(path.sep + 'sourcemaps' + path.sep)
1618
) {
1719
return undefined;
1820
}
1921

20-
return path
21-
.substr(path.lastIndexOf('/') + 1)
22+
return filename
23+
.substr(filename.lastIndexOf(path.sep) + 1)
2224
.replace(/(\.(android|ios|native))?\.js$/, '');
2325
},
2426
};

0 commit comments

Comments
 (0)