From cdd736d9e00744c5c2f65073143bf9a0faacb289 Mon Sep 17 00:00:00 2001
From: Ville Immonen <ville.immonen@iki.fi>
Date: Sat, 10 Sep 2016 19:56:43 +0300
Subject: [PATCH] Fix mocking assets with special characters in the file path
 (#584)

The regexes in the Jest `moduleNameMapper` configs were a bit too strict,
causing them to not pick up files with special characters like `@` in the
file path. Change them to match anything with the correct file extension.
---
 scripts/utils/createJestConfig.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/utils/createJestConfig.js b/scripts/utils/createJestConfig.js
index 95a550be5..395151afa 100644
--- a/scripts/utils/createJestConfig.js
+++ b/scripts/utils/createJestConfig.js
@@ -21,8 +21,8 @@ module.exports = (resolve, rootDir) => {
   const config = {
     moduleFileExtensions: ['jsx', 'js', 'json'],
     moduleNameMapper: {
-      '^[./a-zA-Z0-9$_-]+\\.(jpg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm)$': resolve('config/jest/FileStub.js'),
-      '^[./a-zA-Z0-9$_-]+\\.css$': resolve('config/jest/CSSStub.js')
+      '^.+\\.(jpg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm)$': resolve('config/jest/FileStub.js'),
+      '^.+\\.css$': resolve('config/jest/CSSStub.js')
     },
     scriptPreprocessor: resolve('config/jest/transform.js'),
     setupFiles: setupFiles,
-- 
GitLab