@@ -25,32 +25,50 @@ module.exports = {
25
25
verbose : true ,
26
26
cacheDirectory : '<rootDir>/tmp/jest' ,
27
27
moduleFileExtensions : [ 'ts' , 'tsx' , 'js' , 'json' ] ,
28
+ // preset configs
29
+ // preset: 'ts-jest/presets/js-with-ts',
30
+ // which files to test and which to ignore
28
31
testMatch : [ '**/src/tests/*.test.(ts|tsx)' ] ,
29
32
testPathIgnorePatterns : [ '/node_modules/' , '/tmp/' , '/coverage/' , '/stories/' , '/\\.storybook/' ] ,
33
+ // don't watch for file changes in node_modules
30
34
watchPathIgnorePatterns : [ '/node_modules/' ] ,
35
+ // jest automock settings
31
36
automock : false ,
32
37
unmockedModulePathPatterns : [ '/node_modules/' ] ,
33
38
setupFilesAfterEnv : [ './jest.setup.js' ] ,
39
+ // test environment setup
40
+ // setupFiles: [`${__dirname}/setup/setup.js`],
41
+ // setupFilesAfterEnv: [`${__dirname}/setup/setupAfterEnv.ts`],
42
+ // coverage settings
34
43
collectCoverage : true ,
35
44
collectCoverageFrom : [ '**/*.{ts,tsx}' , '!**/*.d.ts' , '!**/node_modules/**' ] ,
36
45
coverageThreshold : {
37
- global : {
38
- branches : 65 ,
39
- functions : 80 ,
40
- lines : 80 ,
41
- statements : 80
46
+ " global" : {
47
+ " branches" : 65 ,
48
+ " functions" : 80 ,
49
+ " lines" : 80 ,
50
+ " statements" : 80
42
51
}
43
52
} ,
44
53
coveragePathIgnorePatterns : [ '/node_modules/' , '\\.json$' , '/__tests__/' , '/stories/' , '/\\.storybook/' ] ,
45
54
46
- transform : {
47
- '^.+\\.(ts|tsx)$' : [ 'ts -jest', {
55
+ globals : {
56
+ 'ts -jest' : {
48
57
tsconfig : `${ __dirname } /tsconfig.json` ,
58
+
59
+ // https://huafu.github.io/ts-jest/user/config/diagnostics
49
60
diagnostics : false ,
61
+
62
+ // Makes jest test run much faster, BUT, without type checking.
63
+ // Type checking in CI is done with `tsc --noEmit` or `yarn typecheck` command.
64
+ // https://huafu.github.io/ts-jest/user/config/isolatedModules
50
65
isolatedModules : true ,
51
- } ] ,
52
- '^.+\\.(js|jsx)$' : 'babel-jest' ,
66
+ } ,
53
67
} ,
54
68
55
69
transformIgnorePatterns : [ '/node_modules/(?!(lodash-es|antd|[^/]+/es|rc-animate|rc-util)/).*' ] ,
56
- } ;
70
+ transform : {
71
+ '\\.(ts|tsx)$' : 'ts-jest' ,
72
+ '/node_modules/((lodash-es|[^/]+/es)|rc-animate|rc-util)/.*' : 'ts-jest' ,
73
+ } ,
74
+ } ;
0 commit comments