@@ -86,8 +86,25 @@ export class TsJestTransformer implements SyncTransformer {
86
86
this . _watchMode = ccs . watchMode
87
87
configSet = ccs . configSet
88
88
} else {
89
+ if ( config . globals ?. [ 'ts-jest' ] ) {
90
+ this . _logger . warn ( Deprecations . GlobalsTsJestConfigOption )
91
+ }
92
+ const jestGlobalsConfig = config . globals ?? { }
93
+ const tsJestGlobalsConfig = jestGlobalsConfig [ 'ts-jest' ] ?? { }
94
+ const migratedConfig = this . tsJestConfig
95
+ ? {
96
+ ...config ,
97
+ globals : {
98
+ ...jestGlobalsConfig ,
99
+ 'ts-jest' : {
100
+ ...tsJestGlobalsConfig ,
101
+ ...this . tsJestConfig ,
102
+ } ,
103
+ } ,
104
+ }
105
+ : config
89
106
// try to look-it up by stringified version
90
- const serializedJestCfg = stringify ( config )
107
+ const serializedJestCfg = stringify ( migratedConfig )
91
108
const serializedCcs = TsJestTransformer . _cachedConfigSets . find (
92
109
( cs ) => cs . jestConfig . serialized === serializedJestCfg ,
93
110
)
@@ -105,24 +122,6 @@ export class TsJestTransformer implements SyncTransformer {
105
122
} else {
106
123
// create the new record in the index
107
124
this . _logger . info ( 'no matching config-set found, creating a new one' )
108
-
109
- if ( config . globals ?. [ 'ts-jest' ] ) {
110
- this . _logger . warn ( Deprecations . GlobalsTsJestConfigOption )
111
- }
112
- const jestGlobalsConfig = config . globals ?? { }
113
- const tsJestGlobalsConfig = jestGlobalsConfig [ 'ts-jest' ] ?? { }
114
- const migratedConfig = this . tsJestConfig
115
- ? {
116
- ...config ,
117
- globals : {
118
- ...jestGlobalsConfig ,
119
- 'ts-jest' : {
120
- ...tsJestGlobalsConfig ,
121
- ...this . tsJestConfig ,
122
- } ,
123
- } ,
124
- }
125
- : config
126
125
configSet = this . _createConfigSet ( migratedConfig )
127
126
const jest = { ...migratedConfig }
128
127
// we need to remove some stuff from jest config
0 commit comments