generated from stagas/ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
63 lines (59 loc) · 1.65 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
60
61
62
63
module.exports = {
testEnvironment: 'jsdom', // or node
rootDir: '.',
roots: ['<rootDir>/test/', '<rootDir>/src'],
testMatch: ['**/*.spec.{js,jsx,ts,tsx}'],
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/test/web/'],
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
coverageProvider: 'v8',
moduleNameMapper: {
'react\\/(jsx-runtime|jsx-dev-runtime)$': 'html-vdom/$1',
},
// enable this for real typescript builds (slow but accurate)
// preset: 'ts-jest',
// enable this for fast, correct sourcemaps but not all features supported
// transform: {
// '\\.(js|jsx|ts|tsx)$': [
// '@stagas/sucrase-jest-plugin',
// {
// jsxPragma: 'h',
// jsxFragmentPragma: 'Fragment',
// production: true,
// disableESTransforms: true,
// },
// ],
// },
// enable this for fast, incorrect sourcemaps but more features supported
transform: {
'\\.(js|jsx|ts|tsx)$': [
'@swc-node/jest',
{
swc: {
jsc: {
target: 'es2022',
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
dynamicImport: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
useDefineForClassFields: true,
react: {
runtime: 'automatic',
importSource: 'html-vdom',
},
hidden: {
jest: true,
},
},
keepClassNames: true,
},
},
},
],
},
}