@@ -93,7 +93,24 @@ module.exports = {
93
93
transform : {
94
94
// Using this directly as opposed to the preset because of
95
95
// to be able to manually specify the ts-jest dependency.
96
- '^.+\\.tsx?$' : require . resolve ( 'ts-jest' ) ,
96
+ '^.+\\.tsx?$' : [
97
+ require . resolve ( 'ts-jest' ) ,
98
+ {
99
+ tsconfig : {
100
+ // Minimise transpilation since tests run in modern Node.
101
+ // https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-12
102
+ target : 'es2019' ,
103
+
104
+ // Some tsconfigs e.g. the ones owned by create-react-app turn this on
105
+ // which causes some type errors across file boundaries to be silenced.
106
+ isolatedModules : false ,
107
+
108
+ // next.js forces `jsx: 'preserve'` for their toolchain, but Jest wants
109
+ // the transformer to transpile the syntax.
110
+ ...( compilerOptions . jsx === ts . JsxEmit . Preserve && { jsx : 'react' } ) ,
111
+ } ,
112
+ } ,
113
+ ] ,
97
114
98
115
// Ignore static assets such as images and stylesheets.
99
116
'\\.(css|less)$' : require . resolve ( './style-mock.js' ) ,
@@ -127,22 +144,4 @@ module.exports = {
127
144
branches : 100 ,
128
145
} ,
129
146
} ,
130
-
131
- globals : {
132
- 'ts-jest' : {
133
- tsconfig : {
134
- // Minimise transpilation since tests run in modern Node.
135
- // https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping#node-12
136
- target : 'es2019' ,
137
-
138
- // Some tsconfigs e.g. the ones owned by create-react-app turn this on
139
- // which causes some type errors across file boundaries to be silenced.
140
- isolatedModules : false ,
141
-
142
- // next.js forces `jsx: 'preserve'` for their toolchain, but Jest wants
143
- // the transformer to transpile the syntax.
144
- ...( compilerOptions . jsx === ts . JsxEmit . Preserve && { jsx : 'react' } ) ,
145
- } ,
146
- } ,
147
- } ,
148
147
} ;
0 commit comments