-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
68 lines (64 loc) · 1.76 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
62
63
64
65
66
67
68
import type { Config } from '@jest/types'
const packages: string[] = [
'react-use-snack',
]
const base: Partial<Config.InitialOptions> = {
transformIgnorePatterns: [
'node_modules/?!(react-use-snack)',
],
transform: {
'^.+\\.ts$': 'ts-jest',
'^.+\\.tsx$': 'ts-jest',
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'^react-use-snack(.*)$': '<rootDir>/packages/react-use-snack/src$1',
},
moduleFileExtensions: [
'ts',
'tsx',
'js',
'jsx',
'json',
'node',
],
coveragePathIgnorePatterns: [
'(tests/.*.mock).(jsx?|tsx?|ts?|js?)$',
'.*.(test|spec).(js|ts|tsx)$',
'<rootDir>/packages/.+/demo',
],
testPathIgnorePatterns: [
'<rootDir>/dist',
'<rootDir>/packages/.+/build',
],
watchPathIgnorePatterns: [
'<rootDir>/.idea',
'<rootDir>/.git',
'<rootDir>/dist',
'<rootDir>/node_modules',
'<rootDir>/packages/.+/node_modules',
'<rootDir>/packages/.+/build',
],
modulePathIgnorePatterns: [
'<rootDir>/dist',
'<rootDir>/packages/.+/build',
],
}
const config: Config.InitialOptions = {
...base,
verbose: true,
collectCoverage: true,
projects: [
...packages.map(pkg => ({
displayName: 'test-' + pkg,
...base,
moduleDirectories: ['node_modules', '<rootDir>/packages/' + pkg + '/node_modules'],
testMatch: [
'<rootDir>/packages/' + pkg + '/src/**/*.(test|spec).(js|ts|tsx)',
'<rootDir>/packages/' + pkg + '/tests/**/*.(test|spec).(js|ts|tsx)',
],
})),
],
coverageDirectory: '<rootDir>/coverage',
}
export default config