diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cc18fc14391..4e405ef69e8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - `[jest-haste-map]` [**BREAKING**] Replaced internal data structures to improve performance ([#6960](https://github.com/facebook/jest/pull/6960)) - `[jest-jasmine2]` Fix memory leak in Error objects hold by the framework ([#6965](https://github.com/facebook/jest/pull/6965)) +- `[jest-haste-map]` Fixed Haste whitelist generation for scoped modules on Windows ([#6980](https://github.com/facebook/jest/pull/6980)) ### Chore & Maintenance diff --git a/packages/jest-haste-map/src/index.js b/packages/jest-haste-map/src/index.js index 86794bb2a5e0..bda8666e1ab3 100644 --- a/packages/jest-haste-map/src/index.js +++ b/packages/jest-haste-map/src/index.js @@ -114,11 +114,14 @@ const escapePathSeparator = string => const getWhiteList = (list: ?Array): ?RegExp => { if (list && list.length) { + const newList = list.map(item => + escapePathSeparator(item.replace(/(\/)/g, path.sep)), + ); return new RegExp( '(' + escapePathSeparator(NODE_MODULES) + '(?:' + - list.join('|') + + newList.join('|') + ')(?=$|' + escapePathSeparator(path.sep) + '))',