|
1 | | -import type { JestConfigWithTsJest } from 'ts-jest'; |
| 1 | +import type { JestConfigWithTsJest } from "ts-jest"; |
2 | 2 |
|
3 | 3 | const jestConfig: JestConfigWithTsJest = { |
4 | | - preset: 'ts-jest', |
5 | | - testEnvironment: 'jsdom', |
6 | | - roots: ['<rootDir>'], |
7 | | - moduleNameMapper: { |
8 | | - '\\.(css|less|sass|scss)$': 'identity-obj-proxy', |
9 | | - 'antd': '<rootDir>/__mocks__/antd/Modal', |
10 | | - '^@assets/(.*)$': '<rootDir>/src/assets/$1', |
11 | | - '^@/(.*)$': '<rootDir>/src/$1', |
12 | | - '^@app/(.*)$': '<rootDir>/src/app/$1', |
13 | | - '^@sass/(.*)$': '<rootDir>/src/assets/sass/$1', |
14 | | - '^@images/(.*)$': '<rootDir>/src/assets/images/$1', |
15 | | - '^@features/(.*)$': '<rootDir>/src/features/$1', |
16 | | - '^@api/(.*)$': '<rootDir>/src/app/api/$1', |
17 | | - '^@stores/(.*)$': '<rootDir>/src/app/stores/$1', |
18 | | - '^@models/(.*)$': '<rootDir>/src/models/$1', |
19 | | - '^@components/(.*)$': '<rootDir>/src/app/common/components/$1', |
20 | | - '^@hooks/(.*)$': '<rootDir>/src/app/common/hooks/$1', |
21 | | - '^@constants/(.*)$': '<rootDir>/src/app/common/constants/$1', |
22 | | - '^@utils/(.*)$': '<rootDir>/src/app/common/utils/$1', |
23 | | - // DEV_NOTE: Down below is the right solution for compiling files by path |
24 | | - // But we need to fix ALL typo errors before it could be compiled |
25 | | - // Temp solution - mocking modules. |
26 | | - // After fixing type error remove mocks or continue using them(as more simple solution) |
27 | | - /* |
28 | | - '^@/(.*)$': '<rootDir>/src/$1', |
29 | | - '^@app/(.*)$': '<rootDir>/src/app/$1', |
30 | | - '^@sass/(.*)$': '<rootDir>/src/assets/sass/$1', |
31 | | - '^@images/(.*)$': '<rootDir>/src/assets/images/$1', |
32 | | - '^@features/(.*)$': '<rootDir>/src/features/$1', |
33 | | - '^@api/(.*)$': '<rootDir>/src/app/api/$1', |
34 | | - '^@stores/(.*)$': '<rootDir>/src/app/stores/$1', |
35 | | - '^@models/(.*)$': '<rootDir>/src/models/$1', |
36 | | - '^@components/(.*)$': '<rootDir>/src/app/common/components/$1', |
37 | | - '^@hooks/(.*)$': '<rootDir>/src/app/common/hooks/$1', |
38 | | - '^@constants/(.*)$': '<rootDir>/src/app/common/constants/$1', |
39 | | - '^@utils/(.*)$': '<rootDir>/src/app/common/utils/$1', |
40 | | - */ |
| 4 | + preset: "ts-jest", |
| 5 | + testEnvironment: "jsdom", |
| 6 | + roots: ["<rootDir>"], |
| 7 | + moduleNameMapper: { |
| 8 | + "\\.(css|less|sass|scss)$": "identity-obj-proxy", |
| 9 | + "^@assets/(.*)$": "<rootDir>/src/assets/$1", |
| 10 | + "^antd/es/upload$": "<rootDir>/__mocks__/antd/es/upload/upload.tsx", |
| 11 | + "^antd/es/date-picker/locale/uk_UA$": "<rootDir>/__mocks__/antd/es/date/localeprovider.tsx", |
| 12 | + "^antd/locale/(.*)$": "<rootDir>/node_modules/antd/locale/$1", |
| 13 | + "^antd/es/table$": "<rootDir>/node_modules/antd/es/table", |
| 14 | + "^@stores/root-store$": "<rootDir>/__mocks__/@stores/root-store.tsx", |
| 15 | + "^antd/(.*)$": "<rootDir>/node_modules/antd/es/$1", |
| 16 | + |
| 17 | + "^@/(.*)$": "<rootDir>/src/$1", |
| 18 | + "^@app/(.*)$": "<rootDir>/src/app/$1", |
| 19 | + "^@sass/(.*)$": "<rootDir>/src/assets/sass/$1", |
| 20 | + "^@images/(.*)$": "<rootDir>/src/assets/images/$1", |
| 21 | + "^@features/(.*)$": "<rootDir>/src/features/$1", |
| 22 | + "^@api/(.*)$": "<rootDir>/src/app/api/$1", |
| 23 | + "^@stores/(.*)$": "<rootDir>/src/app/stores/$1", |
| 24 | + "^@models/(.*)$": "<rootDir>/src/models/$1", |
| 25 | + "^@components/(.*)$": "<rootDir>/src/app/common/components/$1", |
| 26 | + "^@hooks/(.*)$": "<rootDir>/src/app/common/hooks/$1", |
| 27 | + "^@constants/(.*)$": "<rootDir>/src/app/common/constants/$1", |
| 28 | + "^@utils/(.*)$": "<rootDir>/src/app/common/utils/$1", |
| 29 | + }, |
| 30 | + verbose: true, |
| 31 | + collectCoverageFrom: [ |
| 32 | + "src/**/*.{ts,js}", // temp disable coverage collection for tsx, jsx until type errors will be fixed |
| 33 | + ], |
| 34 | + globals: { |
| 35 | + _env_: { |
| 36 | + API_URL: "https://mock_URL.com", |
41 | 37 | }, |
42 | | - verbose: true, |
43 | | - collectCoverageFrom: [ |
44 | | - "src/**/*.{ts,js}" // temp disable coverage collection for tsx, jsx until type errors will be fixed |
45 | | - ], |
46 | | - globals: { |
47 | | - _env_: { |
48 | | - API_URL: 'https://mock_URL.com', |
49 | | - } |
| 38 | + }, |
| 39 | + transform: { |
| 40 | + "^.+\\.svg$": "jest-transformer-svg", |
| 41 | + }, |
| 42 | + coverageThreshold: { |
| 43 | + global: { |
| 44 | + statements: 0.1, |
| 45 | + branches: 0.0, |
| 46 | + functions: 0.0, |
| 47 | + lines: 0.1, |
50 | 48 | }, |
51 | | - transform: { |
52 | | - "^.+\\.svg$": "jest-transformer-svg", |
53 | | - }, |
54 | | - coverageThreshold: { |
55 | | - global: { |
56 | | - statements: 0.1, |
57 | | - branches: 0.0, |
58 | | - functions: 0.0, |
59 | | - lines: 0.1, |
60 | | - } |
61 | | - }, |
62 | | -} |
| 49 | + }, |
| 50 | +}; |
63 | 51 |
|
64 | | -export default jestConfig |
| 52 | +export default jestConfig; |
0 commit comments