Commit 715de0de authored by Ville Immonen's avatar Ville Immonen Committed by GitHub
Browse files

Revert Jest moduleNameMapper regex back to a whitelist (#1149)

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.
parent b57d8711
No related merge requests found
Showing with 1 addition and 1 deletion
+1 -1
...@@ -20,7 +20,7 @@ module.exports = (resolve, rootDir, isEjecting) => { ...@@ -20,7 +20,7 @@ module.exports = (resolve, rootDir, isEjecting) => {
const config = { const config = {
collectCoverageFrom: ['src/**/*.{js,jsx}'], collectCoverageFrom: ['src/**/*.{js,jsx}'],
moduleNameMapper: { 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') '^.+\\.css$': resolve('config/jest/CSSStub.js')
}, },
setupFiles: [resolve('config/polyfills.js')], setupFiles: [resolve('config/polyfills.js')],
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment