-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
70 lines (53 loc) · 1.56 KB
/
Copy pathjest.config.js
File metadata and controls
70 lines (53 loc) · 1.56 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
/** @type {import('jest').Config} */
export default {
// Test environment for React components
testEnvironment: 'jsdom',
// Paths to search for tests
roots: ['<rootDir>/src'],
// File patterns to match test files
testMatch: ['**/__tests__/**/*.jsx', '**/?(*.)+(spec|test).jsx'],
// File extensions to consider
moduleFileExtensions: ['js', 'jsx', 'json'],
// Setup files after environment is set up
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
// Module name mapper for imports
moduleNameMapper: {
// Handle CSS imports (without CSS modules)
'\\.css$': '<rootDir>/__mocks__/styleMock.js',
// Handle image imports
'\\.(jpg|jpeg|png|gif|svg)$': '<rootDir>/__mocks__/fileMock.js',
// Handle module aliases
'^@/(.*)$': '<rootDir>/src/$1',
},
// Transform files with Babel
transform: {
'^.+\\.(js|jsx)$': ['babel-jest', { useESM: true }],
},
// Transform ignore patterns for ES modules
transformIgnorePatterns: [
'node_modules/(?!(axios)/)'
],
// Paths to ignore
testPathIgnorePatterns: ['/node_modules/'],
// Collect coverage information
collectCoverage: true,
// Directory for coverage reports
coverageDirectory: 'coverage',
// Coverage reporters
coverageReporters: ['text', 'lcov', 'clover', 'json'],
// Minimum coverage thresholds
coverageThreshold: {
global: {
statements: 70,
branches: 70,
functions: 70,
lines: 70,
},
},
// Verbose output
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Test timeout
testTimeout: 15000,
};