From 139ca7893d43fd10019dbe13d921cba1dce97d20 Mon Sep 17 00:00:00 2001 From: NikitaMazur Date: Fri, 30 Nov 2018 16:10:40 +0200 Subject: [PATCH] add test configs to project --- jest.conf.json | 14 ++++++++++++-- mocks/fileMock.js | 1 + mocks/styleMock.js | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 mocks/fileMock.js create mode 100644 mocks/styleMock.js diff --git a/jest.conf.json b/jest.conf.json index 8debb92..b3b004e 100644 --- a/jest.conf.json +++ b/jest.conf.json @@ -1,7 +1,17 @@ { "roots": ["./src/app"], - "testRegex": ".*\\.test.(js|jsx)$", + "testRegex": "/src/app/.*\\.test.(js|jsx)$", "unmockedModulePathPatterns": [ - "./node_modules/react" + "./node_modules/react" + ], + "moduleNameMapper": { + "^.+\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/mocks/fileMock.js", + ".*?\\.(css|scss)$": "/mocks/styleMock.js" + }, + "setupFiles": [ + "./test-setup.js" + ], + "modulePaths": [ + "src/app" ] } diff --git a/mocks/fileMock.js b/mocks/fileMock.js new file mode 100644 index 0000000..0e56c5b --- /dev/null +++ b/mocks/fileMock.js @@ -0,0 +1 @@ +module.exports = 'test-file-stub' diff --git a/mocks/styleMock.js b/mocks/styleMock.js new file mode 100644 index 0000000..4ba52ba --- /dev/null +++ b/mocks/styleMock.js @@ -0,0 +1 @@ +module.exports = {}