From fb20dddfe9c6c5c41e95cad68fcdb46e5397f98e Mon Sep 17 00:00:00 2001 From: empyrical Date: Mon, 17 Sep 2018 12:26:30 -0600 Subject: [PATCH] fix(jest-haste-map): Fixed Haste whitelist generation for scoped modules on Windows (#6980) --- CHANGELOG.md | 1 + packages/jest-haste-map/src/index.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a78fca45f58..6c1a0693ca73 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - `[jest-haste-map]` [**BREAKING**] Replace internal data structures to improve performance ([#6960](https://github.com/facebook/jest/pull/6960)) - `[jest-haste-map]` Do not visit again files with the same sha-1 ([#6990](https://github.com/facebook/jest/pull/6990)) - `[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) + '))',