forked from Open-Cap-Stack/opencap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
65 lines (57 loc) · 1.45 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
57
58
59
60
61
62
63
64
65
// jest.config.js
const path = require('path');
module.exports = {
// Core Configuration
testEnvironment: 'node',
testTimeout: 30000,
verbose: true,
// File Patterns and Locations
roots: ['<rootDir>/__tests__/'],
moduleFileExtensions: ['js', 'json'],
testMatch: ['**/*.test.js'],
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/coverage/',
'/build/'
],
// Setup Files
setupFilesAfterEnv: [
path.resolve(__dirname, '__tests__/setup/jest.setup.js')
],
// Path Aliases
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
'^@middleware/(.*)$': '<rootDir>/middleware/$1',
'^@routes/(.*)$': '<rootDir>/routes/$1',
'^@controllers/(.*)$': '<rootDir>/controllers/$1',
'^@models/(.*)$': '<rootDir>/models/$1',
'^@utils/(.*)$': '<rootDir>/utils/$1',
'^@config/(.*)$': '<rootDir>/config/$1',
'^@services/(.*)$': '<rootDir>/services/$1'
},
// Mock Behavior
clearMocks: true,
restoreMocks: true,
// Coverage Settings
collectCoverage: true,
coverageDirectory: 'coverage',
collectCoverageFrom: [
'routes/**/*.js',
'models/**/*.js',
'controllers/**/*.js',
'services/**/*.js',
'utils/**/*.js',
'!**/node_modules/**',
'!**/__tests__/**',
'!**/coverage/**',
'!**/dist/**'
],
coverageReporters: ['text', 'lcov'],
// Transform and Timing
transform: {
'^.+\\.js$': 'babel-jest'
},
// Error Handling
errorOnDeprecated: true
};