-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
53 lines (53 loc) · 1.49 KB
/
jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
module.exports = {
rootDir: './',
moduleFileExtensions: [ 'js', 'json' ],
transform: {
// should be above any other js transform like babel-jest
'^.+\\.stories\\.js$': '@storybook/addon-storyshots/injectFileName',
'^.+\\.js$': 'babel-jest',
'^.+\\.(js|jsx)?$': 'babel-jest',
},
transformIgnorePatterns: [ 'node_modules/(?!react-syntax-highlighter)' ], // fixed in storybook 6.0
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/tests/__mocks__/file-mock.js',
'\\.(css|scss)$': '<rootDir>/tests/__mocks__/style-mock.js'
},
reporters: [
[ 'jest-nyancat-reporter', { 'suppressErrorReporter': false } ],
// 'default'
],
collectCoverageFrom: [
'src/**/*.js'
],
coveragePathIgnorePatterns: [
'src/index.js',
'/node_modules/',
],
// these should match sonar !
coverageThreshold: {
global: {
branches: 65,
functions: 80,
lines: 65,
statements: 80
},
'./src/**/*.js': { // per file
branches: 65,
functions: 80,
lines: 65,
statements: 80
}
},
setupFilesAfterEnv: [
'jest-enzyme',
'./node_modules/jest-enzyme/lib/index.js',
'./tests/jest.setup.js',
],
snapshotSerializers: [
'enzyme-to-json/serializer'
],
testEnvironment: 'enzyme',
testEnvironmentOptions: {
enzymeAdapter: 'react16'
}
};