-
Notifications
You must be signed in to change notification settings - Fork 7
/
jest.config.ts
61 lines (58 loc) · 1.81 KB
/
jest.config.ts
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
import { Config } from '@jest/types'
import { pathsToModuleNameMapper, RawCompilerOptions } from 'ts-jest'
import { compilerOptions } from './tsconfig.json'
const jestCompilerOptions: Omit<RawCompilerOptions, 'paths'> & {
paths: Record<string, string[]>
} = {
...(compilerOptions as any),
lib: [...compilerOptions.lib, 'DOM'],
paths: {
'@zedux/atoms': ['./packages/atoms/src'],
'@zedux/atoms/*': ['./packages/atoms/src/*'],
'@zedux/core': ['./packages/core/src'],
'@zedux/core/*': ['./packages/core/src/*'],
'@zedux/machines': ['./packages/machines/src'],
'@zedux/machines/*': ['./packages/machines/src/*'],
'@zedux/react': ['./packages/react/src'],
'@zedux/react/*': ['./packages/react/src/*'],
'@zedux/stores': ['./packages/stores/src'],
'@zedux/stores/*': ['./packages/stores/src/*'],
},
}
const config: Config.InitialOptions = {
collectCoverage: true,
collectCoverageFrom: ['**/src/**'],
globals: {
DEV: true,
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
moduleNameMapper: pathsToModuleNameMapper(jestCompilerOptions.paths || {}, {
prefix: '<rootDir>/',
}),
modulePaths: [compilerOptions.baseUrl],
preset: 'ts-jest',
roots: [
'<rootDir>/packages/atoms/src',
'<rootDir>/packages/atoms/test',
'<rootDir>/packages/core/src',
'<rootDir>/packages/core/test',
'<rootDir>/packages/machines/src',
'<rootDir>/packages/machines/test',
'<rootDir>/packages/react/src',
'<rootDir>/packages/react/test',
'<rootDir>/packages/core/src',
'<rootDir>/packages/core/test',
],
setupFilesAfterEnv: ['./jest.setup.ts'],
testEnvironment: 'jsdom',
testRegex: '/test/.*\\.test\\.tsx?$',
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
tsconfig: jestCompilerOptions,
},
],
},
}
export default config