-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.ts
More file actions
55 lines (47 loc) · 1.39 KB
/
jest.config.ts
File metadata and controls
55 lines (47 loc) · 1.39 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
import type { Config } from 'jest';
const path = require('path');
const config: Config = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
// Основные настройки
clearMocks: true,
// Настройки трансформации
transform: {
'.+\\.(css|styl|less|sass|scss)$': 'jest-css-modules-transform',
"^.+\\.(ts|tsx)$": "ts-jest",
"^.+\\.(js|jsx)$": "babel-jest",
},
// Маппинг модулей
moduleNameMapper: {
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/src/mocks/fileMock.js',
'^@/(.*)$': path.resolve(__dirname, './src/$1'),
},
// Директории и расширения
moduleDirectories: [
'node_modules',
'src'
],
moduleFileExtensions: [
'js',
'mjs',
'cjs',
'jsx',
'ts',
'tsx',
'json',
'node'
],
// Паттерны для поиска тестов
testMatch: [
'**/__tests__/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[tj]s?(x)'
],
// Игнорирование некоторых путей при трансформации
transformIgnorePatterns: [
'/node_modules/(?!your-esm-package|another-esm-package)'
],
// Дополнительные настройки
setupFilesAfterEnv: ['<rootDir>/jest/setupTests.ts']
};
export default config;