From f3c1cf635573a605f8933528880a7c88320b1117 Mon Sep 17 00:00:00 2001 From: Justin Falcone Date: Mon, 21 Nov 2016 12:37:59 -0500 Subject: [PATCH 1/3] preprocess local node_modules for jest --- packages/react-scripts/utils/createJestConfig.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index df0238f2587..87e1f4d4ad8 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/utils/createJestConfig.js @@ -28,6 +28,7 @@ module.exports = (resolve, rootDir, isEjecting) => { setupTestFrameworkScriptFile: setupTestsFile, testPathIgnorePatterns: ['/(build|docs|node_modules)/'], testEnvironment: 'node', + preprocessorIgnorePatterns: ["/node_modules"], }; if (rootDir) { config.rootDir = rootDir; From 08efff7eca226049ea3fa4862baddf299ba5fb51 Mon Sep 17 00:00:00 2001 From: Justin Falcone Date: Mon, 21 Nov 2016 14:26:21 -0500 Subject: [PATCH 2/3] only ignore root node_modules --- packages/react-scripts/template/gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-scripts/template/gitignore b/packages/react-scripts/template/gitignore index 6c96c5cff12..7e2b5959988 100644 --- a/packages/react-scripts/template/gitignore +++ b/packages/react-scripts/template/gitignore @@ -1,7 +1,7 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # dependencies -node_modules +/node_modules # testing coverage From 3ed5b12cccef096c494c9ebb3123305788bc5ff7 Mon Sep 17 00:00:00 2001 From: Justin Falcone Date: Fri, 2 Dec 2016 02:14:17 +1100 Subject: [PATCH 3/3] haste providesModuleNodeModules hack --- packages/react-scripts/utils/createJestConfig.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js index 87e1f4d4ad8..5b626d3802d 100644 --- a/packages/react-scripts/utils/createJestConfig.js +++ b/packages/react-scripts/utils/createJestConfig.js @@ -29,6 +29,9 @@ module.exports = (resolve, rootDir, isEjecting) => { testPathIgnorePatterns: ['/(build|docs|node_modules)/'], testEnvironment: 'node', preprocessorIgnorePatterns: ["/node_modules"], + haste: { + providesModuleNodeModules: [".*"], + }, }; if (rootDir) { config.rootDir = rootDir;