Skip to content

Commit 89458fc

Browse files
committed
refactor: remove manual version checker
This is taken care by `peerDependencies` mechanism
1 parent 7dfef71 commit 89458fc

File tree

4 files changed

+2
-212
lines changed

4 files changed

+2
-212
lines changed

src/legacy/ts-jest-transformer.ts

-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { stringify, JsonableValue, rootLogger } from '../utils'
1616
import { importer } from '../utils/importer'
1717
import { Deprecations, Errors, interpolate } from '../utils/messages'
1818
import { sha1 } from '../utils/sha1'
19-
import { VersionCheckers } from '../utils/version-checkers'
2019

2120
import { TsJestCompiler } from './compiler'
2221
import { ConfigSet } from './config/config-set'
@@ -55,7 +54,6 @@ export class TsJestTransformer implements SyncTransformer<TsJestTransformerOptio
5554

5655
constructor(private readonly transformerOptions?: TsJestTransformerOptions) {
5756
this._logger = rootLogger.child({ namespace: 'ts-jest-transformer' })
58-
VersionCheckers.jest.warn()
5957
/**
6058
* For some unknown reasons, `this` is undefined in `getCacheKey` and `process`
6159
* when running Jest in ESM mode

src/utils/importer.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type { TBabelCore, TBabelJest, TTypeScript } from '../types'
2-
import type { TEsBuild } from '../types'
1+
import type { TBabelCore, TBabelJest, TTypeScript, TEsBuild } from '../types'
32

43
import { rootLogger } from './logger'
54
import { Memoize } from './memoize'
65
import { Errors, Helps, ImportReasons, interpolate } from './messages'
7-
import { VersionCheckers } from './version-checkers'
86

97
// eslint-disable-next-line @typescript-eslint/no-explicit-any
108
type ModulePatcher<T = any> = (module: T) => T
@@ -20,13 +18,6 @@ interface ImportOptions {
2018
installTip?: string | Array<{ module: string; label: string }>
2119
}
2220

23-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
24-
const passThru = (action: () => void) => (input: any) => {
25-
action()
26-
27-
return input
28-
}
29-
3021
/**
3122
* @internal
3223
*/
@@ -38,12 +29,7 @@ export class Importer {
3829
// here we can define patches to apply to modules.
3930
// it could be fixes that are not deployed, or
4031
// abstractions so that multiple versions work the same
41-
return new Importer({
42-
'@babel/core': [passThru(VersionCheckers.babelCore.warn)],
43-
'babel-jest': [passThru(VersionCheckers.babelJest.warn)],
44-
typescript: [passThru(VersionCheckers.typescript.warn)],
45-
jest: [passThru(VersionCheckers.jest.warn)],
46-
})
32+
return new Importer()
4733
}
4834

4935
constructor(protected _patches: { [moduleName: string]: ModulePatcher[] } = {}) {}

src/utils/version-checkers.spec.ts

-88
This file was deleted.

src/utils/version-checkers.ts

-106
This file was deleted.

0 commit comments

Comments
 (0)