-
Notifications
You must be signed in to change notification settings - Fork 196
/
jest.config.base.js
61 lines (60 loc) · 1.81 KB
/
jest.config.base.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
const path = require('path');
module.exports = {
runner: 'jest-electron/runner',
testEnvironment: 'jest-electron/environment',
setupFilesAfterEnv: ['jest-extended', './__tests__/setup.js'],
clearMocks: true,
collectCoverage: false,
collectCoverageFrom: [
'src/**/*.{ts,tsx,js,vue}',
'!**/node_modules/**',
'!**/interface/**',
'!**/interface.ts',
'!**/i18n/**',
'!**/icons/**',
'!**/constant/**',
'!**/constant.ts',
'!**/index.{ts,tsx,js,vue}',
'!**/icons.{ts,tsx,js,vue}',
],
coveragePathIgnorePatterns: [
'facet/mobile',
'hd-adapter/index.ts',
'packages/s2-vue',
],
coverageReporters: ['text', 'clover', 'html'],
transformIgnorePatterns: [],
testRegex: '/__tests__/*.*(-|\\.)spec\\.(tsx|ts|js|vue)?$',
transform: {
'\\.(t|j)sx?$': [
'@swc/jest',
{
jsc: {
transform: {
// https://swc.rs/docs/configuration/compilation#jsctransformusedefineforclassfields
useDefineForClassFields: false,
},
},
},
],
'\\.vue$': 'vue-jest',
'\\.(less|css)$': 'jest-less-loader',
'\\.svg$': 'jest-raw-loader',
},
moduleNameMapper: {
'\\.svg$': '<rootDir>/__tests__/__mocks__/svg.ts',
'^@/(.*)': '<rootDir>/src/$1',
'^tests/(.*)': '<rootDir>/__tests__/$1',
'^@antv/s2$': path.join(__dirname, 'packages/s2-core/src'),
'^@antv/s2/esm/(.*)$': path.join(__dirname, 'packages/s2-core/src/$1'),
'^@antv/s2/extends$': path.join(__dirname, 'packages/s2-core/src/extends'),
'^@antv/s2-react$': path.join(__dirname, 'packages/s2-react/src'),
'^@antv/s2-react-components$': path.join(
__dirname,
'packages/s2-react-components/src',
),
/* ignore module query: foo.less?a=1 -> foo.less */
'(.+)\\.(.+)\\?(.*)$': '$1.$2',
},
testTimeout: 30000,
};