From 715de0de6b1cdfbff41e6f78b561c4750c42fcf3 Mon Sep 17 00:00:00 2001
From: Ville Immonen <ville.immonen@iki.fi>
Date: Sun, 4 Dec 2016 10:57:57 +0200
Subject: [PATCH] Revert Jest moduleNameMapper regex back to a whitelist
 (#1149)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Jest matches moduleNameMapper regexes with module names, not the full
file path, so the negative lookahead doesn’t work for filtering out
JS files, because they can be imported without the extension. So paths
like `lodash.assign` and `../utils/range` were mislabeled as resources
with unknown file extensions because they have a dot in the name.

As a stopgap measure, revert the moduleNameMapper regex added in #1077.
---
 packages/react-scripts/utils/createJestConfig.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/packages/react-scripts/utils/createJestConfig.js b/packages/react-scripts/utils/createJestConfig.js
index 46f3a1da1..38bef1006 100644
--- a/packages/react-scripts/utils/createJestConfig.js
+++ b/packages/react-scripts/utils/createJestConfig.js
@@ -20,7 +20,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
   const config = {
     collectCoverageFrom: ['src/**/*.{js,jsx}'],
     moduleNameMapper: {
-      '^.+\\.(?!(js|jsx|css|json)$)[^\\.]+$': resolve('config/jest/FileStub.js'),
+      '^.+\\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': resolve('config/jest/FileStub.js'),
       '^.+\\.css$': resolve('config/jest/CSSStub.js')
     },
     setupFiles: [resolve('config/polyfills.js')],
-- 
GitLab