-
Notifications
You must be signed in to change notification settings - Fork 2
/
jest.config.mjs
60 lines (53 loc) · 1.45 KB
/
jest.config.mjs
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
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
import { defaults } from 'jest-config';
const swcJestConfig = {
sourceMaps: false,
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
},
transform: {
react: {
runtime: 'automatic',
},
},
},
};
const configs = {
moduleFileExtensions: [...defaults.moduleFileExtensions, 'js', 'ts', 'tsx'],
verbose: true,
testRegex: '(/__test__/.*|(\\.|/)(test|spec))\\.tsx?$',
resolver: path.resolve(__dirname, './scripts/jest-resolver.cjs'),
transform: {
'^.+\\.(ts|tsx)?$': ['@swc/jest', swcJestConfig],
'^.+\\.(js|jsx)$': ['@swc/jest', swcJestConfig],
},
transformIgnorePatterns: [
'^/node_modules/(?!react-dnd|dnd-core|query-string|lodash-es|@react-dnd)',
],
maxWorkers: process.env.JEST_MAX_WORKER || '100%',
coveragePathIgnorePatterns: [
'/dist/',
'/lib/',
'/es/',
'/node_modules/',
'/mock/',
'/docs/',
'/scripts/mock/',
],
collectCoverageFrom: ['**/*/src/**/*.{js,jsx,ts,tsx}'],
moduleDirectories: ['node_modules', 'src', 'es'],
moduleNameMapper: {
'\\.(less|css)$': 'jest-less-loader',
},
extensionsToTreatAsEsm: ['.ts', '.tsx'],
testEnvironment: 'jsdom',
coverageProvider: 'v8',
coverageReporters: ['text-summary', 'json-summary', 'json', 'lcov'],
};
export default configs;