Skip to content

Commit

Permalink
fix(legacy): include existing globals config in cached config (#3803)
Browse files Browse the repository at this point in the history
When creating `ConfigSet` with migrated Jest config (to migrate from `globals` to transformer config), it is a must to also copy other globals config.
  • Loading branch information
ahnpnl committed Sep 11, 2022
1 parent 6700d7c commit e79be47
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/legacy/ts-jest-transformer.ts
Expand Up @@ -109,17 +109,17 @@ export class TsJestTransformer implements SyncTransformer {
if (config.globals?.['ts-jest']) {
this._logger.warn(Deprecations.GlobalsTsJestConfigOption)
}
configSet = this._createConfigSet(
this.tsJestConfig
? {
...config,
globals: {
'ts-jest': this.tsJestConfig,
},
}
: config,
)
const jest = { ...config }
const migratedConfig = this.tsJestConfig
? {
...config,
globals: {
...(config.globals ?? Object.create(null)),
'ts-jest': this.tsJestConfig,
},
}
: config
configSet = this._createConfigSet(migratedConfig)
const jest = { ...migratedConfig }
// we need to remove some stuff from jest config
// this which does not depend on config
jest.cacheDirectory = undefined as any // eslint-disable-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit e79be47

Please sign in to comment.