-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
56 lines (52 loc) · 1.67 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
54
55
56
require('dotenv').config({ path: 'test.env' });
// Override system NODE_ENV
process.env.NODE_ENV = 'test';
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig.json');
// Transforms tsconfig.json paths to jest's moduleNameMapper
const tsModuleNameMap = pathsToModuleNameMapper(compilerOptions.paths, {
prefix: `${__dirname}/`,
});
const config = {
automock: false,
resetMocks: false,
cacheDirectory: 'node_modules/.cache/jest',
coverageDirectory: './coverage/',
moduleNameMapper: {
"\\.(svg)$": "<rootDir>/__mocks__/svg.ts",
'\\.(css|scss)$': '<rootDir>/__mocks__/transform.js',
...tsModuleNameMap,
},
transform: {
'^.+\\.tsx?$': 'babel-jest',
"^.+\\.js$": "babel-jest",
'\\.(css|scss)$': '<rootDir>/__mocks__/transform.js',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/__mocks__/transform.js',
},
setupFiles: ['<rootDir>/__mocks__/match-media.js'],
testEnvironment: 'jsdom',
coveragePathIgnorePatterns: [
'<rootDir>/src/assets/*',
// Add more patterns as needed
],
setupFilesAfterEnv: ['<rootDir>/setup-jest.config.js'],
coverageThreshold: {
global: {
branches: 70, // Minimum coverage percentage for branches
functions: 70, // Minimum coverage percentage for functions
lines: 70, // Minimum coverage percentage for lines
statements: 70, // Minimum coverage percentage for statements
},
},
collectCoverageFrom: [
'src/**/*.ts',
'src/**/*.tsx',
'!src/lib/**/*',
'!src/lib/**/*',
'!src/**/*.test.ts',
'!src/**/*.test.tsx',
'!src/index.tsx',
],
};
module.exports = config;