@@ -9,9 +9,8 @@ import type {
9
9
CompiledOutput ,
10
10
CompilerInstance ,
11
11
DepGraphInfo ,
12
- ProjectConfigTsJest ,
13
- TransformOptionsTsJest ,
14
- TsJestGlobalOptions ,
12
+ TsJestTransformerOptions ,
13
+ TsJestTransformOptions ,
15
14
} from '../types'
16
15
import { parse , stringify , JsonableValue , rootLogger } from '../utils'
17
16
import { importer } from '../utils/importer'
@@ -24,7 +23,7 @@ import { ConfigSet } from './config/config-set'
24
23
25
24
interface CachedConfigSet {
26
25
configSet : ConfigSet
27
- jestConfig : JsonableValue < ProjectConfigTsJest >
26
+ jestConfig : JsonableValue < TsJestTransformOptions [ 'config' ] >
28
27
transformerCfgStr : string
29
28
compiler : CompilerInstance
30
29
depGraphs : Map < string , DepGraphInfo >
@@ -42,7 +41,7 @@ interface TsJestHooksMap {
42
41
*/
43
42
export const CACHE_KEY_EL_SEPARATOR = '\x00'
44
43
45
- export class TsJestTransformer implements SyncTransformer {
44
+ export class TsJestTransformer implements SyncTransformer < TsJestTransformerOptions > {
46
45
/**
47
46
* cache ConfigSet between test runs
48
47
*
@@ -56,7 +55,7 @@ export class TsJestTransformer implements SyncTransformer {
56
55
private _depGraphs : Map < string , DepGraphInfo > = new Map < string , DepGraphInfo > ( )
57
56
private _watchMode = false
58
57
59
- constructor ( private readonly tsJestConfig ?: TsJestGlobalOptions ) {
58
+ constructor ( private readonly tsJestConfig ?: TsJestTransformOptions [ 'transformerConfig' ] ) {
60
59
this . _logger = rootLogger . child ( { namespace : 'ts-jest-transformer' } )
61
60
VersionCheckers . jest . warn ( )
62
61
/**
@@ -72,7 +71,7 @@ export class TsJestTransformer implements SyncTransformer {
72
71
process . env . TS_JEST = '1'
73
72
}
74
73
75
- private _configsFor ( transformOptions : TransformOptionsTsJest ) : ConfigSet {
74
+ private _configsFor ( transformOptions : TsJestTransformOptions ) : ConfigSet {
76
75
const { config, cacheFS } = transformOptions
77
76
const ccs : CachedConfigSet | undefined = TsJestTransformer . _cachedConfigSets . find (
78
77
( cs ) => cs . jestConfig . value === config ,
@@ -148,7 +147,7 @@ export class TsJestTransformer implements SyncTransformer {
148
147
}
149
148
150
149
// eslint-disable-next-line class-methods-use-this
151
- protected _createConfigSet ( config : ProjectConfigTsJest | undefined ) : ConfigSet {
150
+ protected _createConfigSet ( config : TsJestTransformOptions [ 'config' ] | undefined ) : ConfigSet {
152
151
return new ConfigSet ( config )
153
152
}
154
153
@@ -159,7 +158,7 @@ export class TsJestTransformer implements SyncTransformer {
159
158
/**
160
159
* @public
161
160
*/
162
- process ( sourceText : string , sourcePath : string , transformOptions : TransformOptionsTsJest ) : TransformedSource {
161
+ process ( sourceText : string , sourcePath : string , transformOptions : TsJestTransformOptions ) : TransformedSource {
163
162
this . _logger . debug ( { fileName : sourcePath , transformOptions } , 'processing' , sourcePath )
164
163
165
164
const configs = this . _configsFor ( transformOptions )
@@ -185,7 +184,7 @@ export class TsJestTransformer implements SyncTransformer {
185
184
async processAsync (
186
185
sourceText : string ,
187
186
sourcePath : string ,
188
- transformOptions : TransformOptionsTsJest ,
187
+ transformOptions : TsJestTransformOptions ,
189
188
) : Promise < TransformedSource > {
190
189
this . _logger . debug ( { fileName : sourcePath , transformOptions } , 'processing' , sourcePath )
191
190
@@ -217,7 +216,7 @@ export class TsJestTransformer implements SyncTransformer {
217
216
private processWithTs (
218
217
sourceText : string ,
219
218
sourcePath : string ,
220
- transformOptions : TransformOptionsTsJest ,
219
+ transformOptions : TsJestTransformOptions ,
221
220
) : CompiledOutput {
222
221
let result : TransformedSource
223
222
const configs = this . _configsFor ( transformOptions )
@@ -269,7 +268,7 @@ export class TsJestTransformer implements SyncTransformer {
269
268
private runTsJestHook (
270
269
sourcePath : string ,
271
270
sourceText : string ,
272
- transformOptions : TransformOptionsTsJest ,
271
+ transformOptions : TsJestTransformOptions ,
273
272
compiledOutput : TransformedSource ,
274
273
) {
275
274
let hooksFile = process . env . TS_JEST_HOOKS
@@ -302,7 +301,7 @@ export class TsJestTransformer implements SyncTransformer {
302
301
*
303
302
* @public
304
303
*/
305
- getCacheKey ( fileContent : string , filePath : string , transformOptions : TransformOptionsTsJest ) : string {
304
+ getCacheKey ( fileContent : string , filePath : string , transformOptions : TsJestTransformOptions ) : string {
306
305
const configs = this . _configsFor ( transformOptions )
307
306
308
307
this . _logger . debug ( { fileName : filePath , transformOptions } , 'computing cache key for' , filePath )
@@ -365,7 +364,7 @@ export class TsJestTransformer implements SyncTransformer {
365
364
async getCacheKeyAsync (
366
365
sourceText : string ,
367
366
sourcePath : string ,
368
- transformOptions : TransformOptionsTsJest ,
367
+ transformOptions : TsJestTransformOptions ,
369
368
) : Promise < string > {
370
369
return Promise . resolve ( this . getCacheKey ( sourceText , sourcePath , transformOptions ) )
371
370
}
0 commit comments