-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
46 lines (45 loc) · 1.29 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
/**
* Jest configuration
*
* @author Vinh Le <[email protected]>
*
*/
module.exports = {
preset: 'ts-jest',
setupFilesAfterEnv: ['<rootDir>/config/testing/setupTests.ts'],
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.test.{js,jsx,ts,tsx}',
'!src/index.tsx',
'!src/App.tsx',
],
// individual test will be reported
verbose: true,
// Automatically clear mock calls and instances between every test
clearMocks: true,
moduleDirectories: ['node_modules', 'src'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'node', 'json'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/config/testing/__mocks__/fileMock.ts',
'\\.(css|less|sass|scss)$':
'<rootDir>/config/testing/__mocks__/styleMock.ts',
'<rootDir>/src/services/i18n.ts':
'<rootDir>/config/testing/__mocks__/i18nMock.tsx',
},
// Where Jest detectes test files
testMatch: [
'<rootDir>/src/**/tests/**/*.{ts,tsx,js,jsx}',
'<rootDir>/src/**/?(*.)(spec|test).{ts,tsx,js,jsx}',
],
// configure minimum threshold enforcement for coverage results
// https://jestjs.io/docs/en/configuration#coveragethreshold-object
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: -10,
},
},
}