From 9e51da426eef3d12b8c27de73ae5000cc2c65e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Louv-Jansen?= Date: Mon, 7 Aug 2017 17:35:59 +0200 Subject: [PATCH] Mock out static files when running in Jest (#13315) --- src/jest/config.json | 6 ++++-- src/jest/file_mock.js | 1 + src/jest/style_mock.js | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 src/jest/file_mock.js create mode 100644 src/jest/style_mock.js diff --git a/src/jest/config.json b/src/jest/config.json index bd57190a46591..f5b7c1260fc33 100644 --- a/src/jest/config.json +++ b/src/jest/config.json @@ -13,7 +13,9 @@ "!ui_framework/components/**/*/index.js" ], "moduleNameMapper": { - "^ui_framework/components": "/ui_framework/components" + "^ui_framework/components": "/ui_framework/components", + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/src/jest/file_mock.js", + "\\.(css|less|scss)$": "/src/jest/style_mock.js" }, "coverageDirectory": "/target/jest-coverage", "coverageReporters": [ @@ -38,4 +40,4 @@ "snapshotSerializers": [ "/node_modules/enzyme-to-json/serializer" ] -} \ No newline at end of file +} diff --git a/src/jest/file_mock.js b/src/jest/file_mock.js new file mode 100644 index 0000000000000..86059f3629249 --- /dev/null +++ b/src/jest/file_mock.js @@ -0,0 +1 @@ +module.exports = 'test-file-stub'; diff --git a/src/jest/style_mock.js b/src/jest/style_mock.js new file mode 100644 index 0000000000000..f053ebf7976e3 --- /dev/null +++ b/src/jest/style_mock.js @@ -0,0 +1 @@ +module.exports = {};