Skip to content

Commit e79be47

Browse files
authoredSep 11, 2022
fix(legacy): include existing globals config in cached config (#3803)
When creating `ConfigSet` with migrated Jest config (to migrate from `globals` to transformer config), it is a must to also copy other globals config.
1 parent 6700d7c commit e79be47

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed
 

‎src/legacy/ts-jest-transformer.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@ export class TsJestTransformer implements SyncTransformer {
109109
if (config.globals?.['ts-jest']) {
110110
this._logger.warn(Deprecations.GlobalsTsJestConfigOption)
111111
}
112-
configSet = this._createConfigSet(
113-
this.tsJestConfig
114-
? {
115-
...config,
116-
globals: {
117-
'ts-jest': this.tsJestConfig,
118-
},
119-
}
120-
: config,
121-
)
122-
const jest = { ...config }
112+
const migratedConfig = this.tsJestConfig
113+
? {
114+
...config,
115+
globals: {
116+
...(config.globals ?? Object.create(null)),
117+
'ts-jest': this.tsJestConfig,
118+
},
119+
}
120+
: config
121+
configSet = this._createConfigSet(migratedConfig)
122+
const jest = { ...migratedConfig }
123123
// we need to remove some stuff from jest config
124124
// this which does not depend on config
125125
jest.cacheDirectory = undefined as any // eslint-disable-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)
Please sign in to comment.