diff --git a/visual_console/__mocks__/fileMock.js b/visual_console/__mocks__/fileMock.js new file mode 100644 index 0000000000..0a445d0600 --- /dev/null +++ b/visual_console/__mocks__/fileMock.js @@ -0,0 +1 @@ +module.exports = "test-file-stub"; diff --git a/visual_console/__mocks__/styleMock.js b/visual_console/__mocks__/styleMock.js new file mode 100644 index 0000000000..f053ebf797 --- /dev/null +++ b/visual_console/__mocks__/styleMock.js @@ -0,0 +1 @@ +module.exports = {}; diff --git a/visual_console/jest.config.js b/visual_console/jest.config.js index b8f59061e9..71be38cdb7 100644 --- a/visual_console/jest.config.js +++ b/visual_console/jest.config.js @@ -4,5 +4,12 @@ module.exports = { "^.+\\.tsx?$": "ts-jest" }, testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$", - moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"] + moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"], + // This configuration is used to mock the css and file imports used by Webpack. + // https://jestjs.io/docs/en/webpack.html + moduleNameMapper: { + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": + "/__mocks__/fileMock.js", + "\\.(css|less)$": "/__mocks__/styleMock.js" + } };