Skip to content

Commit

Permalink
Fix mocking assets with special characters in the file path (#584)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fson authored Sep 10, 2016
1 parent d3530f4 commit cdd736d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/utils/createJestConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit cdd736d

Please sign in to comment.