Skip to content

Instantly share code, notes, and snippets.

@coderek
Created November 26, 2020 08:06
Show Gist options
  • Save coderek/0b982f8fa99c9ee4bde1342890c45e56 to your computer and use it in GitHub Desktop.
Save coderek/0b982f8fa99c9ee4bde1342890c45e56 to your computer and use it in GitHub Desktop.
jest.config.js
module.exports = {
'collectCoverageFrom': [
'app/**/*.{js,jsx}',
'!app/**/stories/*.{js,jsx}',
'!app/**/*.test.{js,jsx}',
'!app/*/RbGenerated*/*.{js,jsx}',
'!app/global-styles.js',
'!app/*/*/Loadable.{js,jsx}',
'!app/components/index.js',
'!app/sw/**'
],
'testURL': 'http://localhost/',
'coverageThreshold': {
'global': {
'statements': 10,
'branches': 10,
'functions': 10,
'lines': 10
}
},
'globals': {
'__DEV__': false,
'__CONFIG__': {
'BASE_URL': 'http://localhost',
'ENVIRONMENT': 'test',
'SYSTEM_ID': 'global',
'LOYALTY_HOSTNAME_SG': 'ninja-van-test-account.eber.co',
'WEBSITE_URL': 'https://www-test.ninjavan.co'
},
'fetch': () => {}
},
'moduleDirectories': ['node_modules', 'app'],
'moduleNameMapper': {
'.*\\.(css|less|styl|scss|sass)$': '<rootDir>/internals/mocks/cssModule.js',
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/internals/mocks/image.js',
'^@fa-(.*)/(.*)$': '<rootDir>/node_modules/@fortawesome/$1-svg-icons/$2',
'^@nv/rc/(.*)$': '<rootDir>/node_modules/@nv/react-commons/src/$1',
'file-loader': 'identity-obj-proxy'
},
'setupFiles': ['<rootDir>/internals/testing/setup.js', 'jest-date-mock'],
'setupFilesAfterEnv': ['<rootDir>/internals/testing/test-config.js'],
'testRegex': 'tests/.*\\.test\\.js$',
'transform': {
'^.+\\.js?$': 'babel-jest',
'^.+\\.js(?:\\.flow)?$': 'jest-flow-transform'
},
'transformIgnorePatterns': [
'/node_modules/(?!(@nv/react-commons|mapbox-gl|.*/locale)/)'
],
'testResultsProcessor': 'jest-sonar-reporter',
'reporters': [
'default',
['jest-junit', { 'outputDirectory': './coverage', 'suiteName': 'Unit Tests' }]
],
'snapshotSerializers': ['<rootDir>/node_modules/snapshot-diff/serializer.js']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment