-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.js
59 lines (55 loc) · 1.98 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
/* eslint-disable @typescript-eslint/no-var-requires */
process.env.TZ = 'Asia/Shanghai';
const path = require('path');
const { compilerOptions } = require('./tsconfig.json');
const { pathsToModuleNameMapper } = require('ts-jest');
compilerOptions.paths['~/*'][0] = path.resolve(compilerOptions.paths['~/*'][0]);
module.exports = {
transform: {
'^.+\\.(ts|tsx|js|jsx)$': '<rootDir>/scripts/jest/custom-transform.js',
'^.+\\.(png|jpg|jpeg|css|json)$': '<rootDir>/scripts/jest/file-transform.js'
},
transformIgnorePatterns: [
'/dist/',
// Ignore modules without es dir.
'node_modules/(?!(?:.pnpm/)?(.+/es))[^/]+?/(?!(es|node_modules)/)'
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx', 'node'],
testEnvironment: 'jest-environment-jsdom',
resetMocks: true,
moduleNameMapper: {
'.+\\.(css|style|less|sass|scss|ttf|woff|woff2)$': 'identity-obj-proxy',
'@ant-design/plots':
'<rootDir>/packages/shared/lib/testUtil/mockAntDesignPlots.jsx',
'monaco-editor': '<rootDir>/packages/shared/lib/testUtil/mockEditor.jsx',
'@monaco-editor/react':
'<rootDir>/packages/shared/lib/testUtil/mockEditor.jsx',
'@uiw/react-md-editor':
'<rootDir>/packages/shared/lib/testUtil/mockEditor.jsx',
'@actiontech/(.*)': '<rootDir>/packages/$1',
...pathsToModuleNameMapper(compilerOptions.paths)
},
collectCoverageFrom: [
'packages/**/{src,lib}/{page,components,hooks,global,store,utils}/**/*.{ts,tsx}',
'packages/**/src/App.tsx',
'packages/shared/api/common/**',
'!packages/**/index.type.ts',
'!packages/**/index.enum.ts',
'!packages/sqle/src/page/SqlAnalyze/SqlAnalyze/ProcessListCom/**',
'!packages/shared/lib/hooks/usePrompt/index.tsx'
],
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
reporters: [
'default',
[
'jest-slow-test-reporter',
{
numTests: 8,
outputDirectory: 'reports',
outputName: 'report.xml',
color: true,
warnSlowerThan: 6000
}
]
]
};