-
Notifications
You must be signed in to change notification settings - Fork 6
/
jest.config.cjs
62 lines (61 loc) · 1.92 KB
/
jest.config.cjs
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
54
55
56
57
58
59
60
61
62
const defaultCoverage = {
branches: 80,
functions: 85,
lines: 95,
statements: 90,
};
module.exports = {
roots: ['<rootDir>/src'],
collectCoverage: true,
collectCoverageFrom: [
'**/*.{js,jsx,ts,tsx}',
'!**/*.d.ts',
'!__mocks__/**',
'!.next/**',
'!coverage/**',
'!.eslintrc.js',
'!jest/**',
'!src/helpers/**',
'!src/config/axios.ts',
],
coverageThreshold: {
global: defaultCoverage,
'src/components/**': defaultCoverage,
'src/hooks/**': defaultCoverage,
// 'src/store/**': defaultCoverage,
// 'src/layouts/**': defaultCoverage,
// 'src/pages/**': defaultCoverage,
'src/config/**': defaultCoverage,
},
setupFiles: ['fake-indexeddb/auto'],
setupFilesAfterEnv: ['jest-extended/all', './jest/setupTests.ts'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|js|tsx|jsx|mjs)$': ['@swc/jest'],
'^.+\\.svg$': '<rootDir>/jest/svgTransformer.ts',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\](?!(@uppy|nanoid|preact|exifr|camelize-ts)).+\\.(js|jsx|mjs|cjs|ts|tsx)$',
'^.+\\.module\\.(css|sass|scss)$',
],
modulePaths: ['<rootDir>/src'],
moduleNameMapper: {
'^.+\\.(css|scss|png)$': '<rootDir>/jest/CSSStub.ts',
'@config/(.*)': '<rootDir>/src/config/$1',
'@pages/(.*)': '<rootDir>/src/pages/$1',
'@layouts/(.*)': '<rootDir>/src/layouts/$1',
'@components/(.*)': '<rootDir>/src/components/$1',
'@translations/(.*)': '<rootDir>/src/translations/$1',
'@assets/(.*)': '<rootDir>/src/assets/$1',
'@styles/(.*)': '<rootDir>/src/styles/$1',
'@hooks/(.*)': '<rootDir>/src/hooks/$1',
'@store/(.*)': '<rootDir>/src/store/$1',
'@helpers/(.*)': '<rootDir>/src/helpers/$1',
},
moduleFileExtensions: ['tsx', 'ts', 'js', 'json', 'jsx', 'node'],
watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
resetMocks: true,
testEnvironmentOptions: {
customExportConditions: [''],
},
};