diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 00000000..55b1480b --- /dev/null +++ b/jest.config.js @@ -0,0 +1,33 @@ +module.exports = { + coverageDirectory: '/coverage', + collectCoverageFrom: [ + 'src/**/*.{js,jsx,mjs}', + '!src/registerServiceWorker.js', + '!src/index.js', + ], + setupFiles: [ + '/config/polyfills.js', + '/config/setupEnzyme.js', + ], + testMatch: [ '/test/**/*.test.{js,jsx,mjs}' ], + testEnvironment: 'node', + testURL: 'http://localhost', + transform: { + '^.+\\.(js|jsx|mjs)$': '/node_modules/babel-jest', + '^.+\\.css$': '/config/jest/cssTransform.js', + '^(?!.*\\.(js|jsx|mjs|css|json)$)': '/config/jest/fileTransform.js', + }, + transformIgnorePatterns: [ '[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$' ], + moduleNameMapper: { + '^react-native$': 'react-native-web', + }, + moduleFileExtensions: [ + 'web.js', + 'js', + 'json', + 'web.jsx', + 'jsx', + 'node', + 'mjs', + ], +}; diff --git a/package.json b/package.json index a33bb691..c90544e0 100644 --- a/package.json +++ b/package.json @@ -102,41 +102,6 @@ "webpack-manifest-plugin": "1.3.2", "whatwg-fetch": "2.0.3" }, - "jest": { - "coverageDirectory": "/coverage", - "collectCoverageFrom": [ - "src/**/*.{js,jsx,mjs}" - ], - "setupFiles": [ - "/config/polyfills.js", - "/config/setupEnzyme.js" - ], - "testMatch": [ - "/test/**/*.test.{js,jsx,mjs}" - ], - "testEnvironment": "node", - "testURL": "http://localhost", - "transform": { - "^.+\\.(js|jsx|mjs)$": "/node_modules/babel-jest", - "^.+\\.css$": "/config/jest/cssTransform.js", - "^(?!.*\\.(js|jsx|mjs|css|json)$)": "/config/jest/fileTransform.js" - }, - "transformIgnorePatterns": [ - "[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs)$" - ], - "moduleNameMapper": { - "^react-native$": "react-native-web" - }, - "moduleFileExtensions": [ - "web.js", - "js", - "json", - "web.jsx", - "jsx", - "node", - "mjs" - ] - }, "babel": { "presets": [ "react-app"