From 50e1cf66511cfd7f0050606ba7b8b29f2c29e803 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 26 Oct 2016 03:53:38 +0300 Subject: [PATCH] Fix TutorialWebpack.md (#1994) Change regular expressions in `moduleNameMapper` config option. --- docs/TutorialWebpack.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/TutorialWebpack.md b/docs/TutorialWebpack.md index 274c712e10d3..1f61f020d281 100644 --- a/docs/TutorialWebpack.md +++ b/docs/TutorialWebpack.md @@ -51,8 +51,8 @@ However, if you are using CSS Modules then it's better to mock a proxy for your { "jest": { "moduleNameMapper": { - "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "^.+\\.(css|less)$": "/__mocks__/styleMock.js" + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", + "\\.(css|less)$": "/__mocks__/styleMock.js" } } } @@ -86,8 +86,8 @@ make sure you invoke Jest using `node --harmony_proxies node_modules/.bin/jest`. { "jest": { "moduleNameMapper": { - "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", - "^.+\\.(css|less)$": "identity-obj-proxy" + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", + "\\.(css|less)$": "identity-obj-proxy" } } } @@ -112,8 +112,8 @@ For webpack's `modulesDirectories`, and `extensions` options there are direct an "moduleDirectories": ["node_modules", "bower_components", "shared"], "moduleNameMapper": { - "^.+\\.(css|less)$": "/__mocks__/styleMock.js", - "^.+\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + "\\.(css|less)$": "/__mocks__/styleMock.js", + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" } } } @@ -132,8 +132,8 @@ env variable, which you can set, or make use of the `modulePaths` option. "moduleFileExtensions": ["js", "jsx"], "moduleDirectories": ["node_modules", "bower_components", "shared"], "moduleNameMapper": { - "^.+\\.(css|less)$": "/__mocks__/styleMock.js", - "^.+\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + "\\.(css|less)$": "/__mocks__/styleMock.js", + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" } } } @@ -153,11 +153,11 @@ of the `moduleNameMapper` option again. "moduleDirectories": ["node_modules", "bower_components", "shared"], "moduleNameMapper": { - "^react": "/vendor/react-master", + "^react(.*)$": "/vendor/react-master$1", "^config$": "/configs/app-config.js", - "^.+\\.(css|less)$": "/__mocks__/styleMock.js", - "^.+\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" + "\\.(css|less)$": "/__mocks__/styleMock.js", + "\\.(gif|ttf|eot|svg)$": "/__mocks__/fileMock.js" } } }