forked from nyashaushe/Color-Tech
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
81 lines (68 loc) · 1.78 KB
/
jest.config.js
File metadata and controls
81 lines (68 loc) · 1.78 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
// Test patterns
testMatch: [
'**/tests/**/*.test.ts',
'**/tests/**/*.test.tsx',
'**/__tests__/**/*.{ts,tsx}',
'**/src/**/*.{test,spec}.{ts,tsx}'
],
// Setup files
setupFilesAfterEnv: [
'<rootDir>/src/tests/setup.ts',
'<rootDir>/src/tests/jest.setup.ts'
],
// Module mapping
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^@/lib/db$': '<rootDir>/src/lib/__mocks__/db.ts',
'^@/components/(.*)$': '<rootDir>/src/components/$1',
'^@/lib/(.*)$': '<rootDir>/src/lib/$1',
'^@/utils/(.*)$': '<rootDir>/src/utils/$1',
'^@/services/(.*)$': '<rootDir>/src/services/$1',
'^@/config/(.*)$': '<rootDir>/src/config/$1',
},
// Transform configuration
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
tsconfig: 'tsconfig.jest.json',
useESM: false,
}],
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
// Coverage configuration
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/tests/**/*',
'!src/**/*.stories.{ts,tsx}',
'!src/**/node_modules/**',
],
coverageReporters: ['text', 'lcov', 'html', 'clover', 'json'],
coverageDirectory: 'coverage',
// Coverage thresholds
coverageThreshold: {
global: {
branches: 60,
functions: 60,
lines: 60,
statements: 60,
},
},
// Test timeout
testTimeout: 30000,
// Verbose output for CI
verbose: process.env.CI === 'true',
// Clear mocks between tests
clearMocks: true,
restoreMocks: true,
// Ignore patterns
testPathIgnorePatterns: [
'<rootDir>/.next/',
'<rootDir>/node_modules/',
'<rootDir>/coverage/',
],
};
export default config;