Skip to content

Commit

Permalink
Fix TutorialWebpack.md (jestjs#1994)
Browse files Browse the repository at this point in the history
Change regular expressions in `moduleNameMapper` config option.
  • Loading branch information
kastigar authored and cpojer committed Oct 26, 2016
1 parent bff3bce commit b1580ca
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/TutorialWebpack.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)$": "<rootDir>/__mocks__/fileMock.js",
"^.+\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
}
}
}
Expand Down Expand Up @@ -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)$": "<rootDir>/__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)$": "<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "identity-obj-proxy"
}
}
}
Expand All @@ -112,8 +112,8 @@ For webpack's `modulesDirectories`, and `extensions` options there are direct an
"moduleDirectories": ["node_modules", "bower_components", "shared"],

"moduleNameMapper": {
"^.+\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
}
}
}
Expand All @@ -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)$": "<rootDir>/__mocks__/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
}
}
}
Expand All @@ -153,11 +153,11 @@ of the `moduleNameMapper` option again.
"moduleDirectories": ["node_modules", "bower_components", "shared"],

"moduleNameMapper": {
"^react": "<rootDir>/vendor/react-master",
"^react(.*)$": "<rootDir>/vendor/react-master$1",
"^config$": "<rootDir>/configs/app-config.js",

"^.+\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js",
"\\.(gif|ttf|eot|svg)$": "<rootDir>/__mocks__/fileMock.js"
}
}
}
Expand Down

0 comments on commit b1580ca

Please sign in to comment.