Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: merge config from globals with transformer config correctly #3842

Merged
merged 1 commit into from Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/legacy/ts-jest-transformer.spec.ts
Expand Up @@ -304,7 +304,7 @@ describe('TsJestTransformer', () => {
let tr!: TsJestTransformer

beforeEach(() => {
tr = new TsJestTransformer()
tr = new TsJestTransformer({})
jest.spyOn(TsJestCompiler.prototype, 'getResolvedModules').mockReturnValueOnce([])
})

Expand Down
9 changes: 7 additions & 2 deletions src/legacy/ts-jest-transformer.ts
Expand Up @@ -109,12 +109,17 @@ export class TsJestTransformer implements SyncTransformer {
if (config.globals?.['ts-jest']) {
this._logger.warn(Deprecations.GlobalsTsJestConfigOption)
}
const jestGlobalsConfig = config.globals ?? {}
const tsJestGlobalsConfig = jestGlobalsConfig['ts-jest'] ?? {}
const migratedConfig = this.tsJestConfig
? {
...config,
globals: {
...(config.globals ?? Object.create(null)),
'ts-jest': this.tsJestConfig,
...jestGlobalsConfig,
'ts-jest': {
...tsJestGlobalsConfig,
...this.tsJestConfig,
},
},
}
: config
Expand Down