Skip to content

Commit

Permalink
Mock out static files when running in Jest (#13315)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorenlouv authored Aug 7, 2017
1 parent 161b07a commit 8cfbb82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
"!ui_framework/components/**/*/index.js"
],
"moduleNameMapper": {
"^ui_framework/components": "<rootDir>/ui_framework/components"
"^ui_framework/components": "<rootDir>/ui_framework/components",
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/jest/file_mock.js",
"\\.(css|less|scss)$": "<rootDir>/src/jest/style_mock.js"
},
"coverageDirectory": "<rootDir>/target/jest-coverage",
"coverageReporters": [
Expand All @@ -38,4 +40,4 @@
"snapshotSerializers": [
"<rootDir>/node_modules/enzyme-to-json/serializer"
]
}
}
1 change: 1 addition & 0 deletions src/jest/file_mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions src/jest/style_mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};

0 comments on commit 8cfbb82

Please sign in to comment.