@@ -18,10 +18,13 @@ The option is `babelConfig` and it works pretty much as the `tsconfig` option, e
1818// jest.config.js
1919module .exports = {
2020 // [...]
21- globals: {
22- ' ts-jest' : {
23- babelConfig: true ,
24- },
21+ transform: {
22+ ' <regex_match_files>' : [
23+ ' ts-jest' ,
24+ {
25+ babelConfig: true ,
26+ },
27+ ],
2528 },
2629}
2730```
@@ -31,10 +34,13 @@ module.exports = {
3134{
3235 // [...]
3336 "jest" : {
34- "globals" : {
35- "ts-jest" : {
36- "babelConfig" : true
37- }
37+ "transform" : {
38+ "<regex_match_files>" : [
39+ " ts-jest" ,
40+ {
41+ "babelConfig" : true
42+ }
43+ ]
3844 }
3945 }
4046}
@@ -48,10 +54,13 @@ The path should be relative to the current working directory where you start Jes
4854// jest.config.js
4955module .exports = {
5056 // [...]
51- globals: {
52- ' ts-jest' : {
53- babelConfig: ' babelrc.test.js' ,
54- },
57+ transform: {
58+ ' <regex_match_files>' : [
59+ ' ts-jest' ,
60+ {
61+ babelConfig: ' babelrc.test.js' ,
62+ },
63+ ],
5564 },
5665}
5766```
@@ -60,10 +69,13 @@ module.exports = {
6069// OR jest.config.js with require for babelrc
6170module .exports = {
6271 // [...]
63- globals: {
64- ' ts-jest' : {
65- babelConfig: require (' ./babelrc.test.js' ),
66- },
72+ transform: {
73+ ' <regex_match_files>' : [
74+ ' ts-jest' ,
75+ {
76+ babelConfig: require (' ./babelrc.test.js' ),
77+ },
78+ ],
6779 },
6880}
6981```
@@ -73,10 +85,13 @@ module.exports = {
7385{
7486 // [...]
7587 "jest" : {
76- "globals" : {
77- "ts-jest" : {
78- "babelConfig" : " babelrc.test.js"
79- }
88+ "transform" : {
89+ "<regex_match_files>" : [
90+ " ts-jest" ,
91+ {
92+ "babelConfig" : " babelrc.test.js"
93+ }
94+ ]
8095 }
8196 }
8297}
@@ -90,13 +105,16 @@ Refer to the [Babel options](https://babeljs.io/docs/en/next/options) to know wh
90105// jest.config.js
91106module .exports = {
92107 // [...]
93- globals: {
94- ' ts-jest' : {
95- babelConfig: {
96- comments: false ,
97- plugins: [' @babel/plugin-transform-for-of' ],
108+ transform: {
109+ ' <regex_match_files>' : [
110+ ' ts-jest' ,
111+ {
112+ babelConfig: {
113+ comments: false ,
114+ plugins: [' @babel/plugin-transform-for-of' ],
115+ },
98116 },
99- } ,
117+ ] ,
100118 },
101119}
102120```
@@ -106,13 +124,16 @@ module.exports = {
106124{
107125 // [...]
108126 "jest" : {
109- "globals" : {
110- "ts-jest" : {
111- "babelConfig" : {
112- "comments" : false ,
113- "plugins" : [" @babel/plugin-transform-for-of" ]
127+ "transform" : {
128+ "<regex_match_files>" : [
129+ " ts-jest" ,
130+ {
131+ "babelConfig" : {
132+ "comments" : false ,
133+ "plugins" : [" @babel/plugin-transform-for-of" ]
134+ }
114135 }
115- }
136+ ]
116137 }
117138 }
118139}
0 commit comments