@@ -189,6 +189,10 @@ describe('TsJestTransformer', () => {
189
189
...input . transformOptions ,
190
190
config : { ...input . transformOptions . config , instrument : true } ,
191
191
} ) ,
192
+ tr . getCacheKey ( input . fileContent , input . fileName , {
193
+ ...input . transformOptions ,
194
+ supportsStaticESM : true ,
195
+ } ) ,
192
196
tr . getCacheKey ( input . fileContent , input . fileName , {
193
197
...input . transformOptions ,
194
198
config : { ...input . transformOptions . config , rootDir : '/bar' } ,
@@ -242,6 +246,27 @@ describe('TsJestTransformer', () => {
242
246
expect ( cacheKey1 ) . not . toEqual ( cacheKey2 )
243
247
} )
244
248
249
+ test ( 'should be different between supportsStaticESM true and supportsStaticESM false' , ( ) => {
250
+ jest . spyOn ( TsJestCompiler . prototype , 'getResolvedModules' ) . mockReturnValueOnce ( [ ] )
251
+
252
+ const cacheKey1 = tr . getCacheKey ( input . fileContent , input . fileName , {
253
+ ...transformOptionsWithCache ,
254
+ supportsStaticESM : true ,
255
+ } )
256
+
257
+ jest . spyOn ( TsJestCompiler . prototype , 'getResolvedModules' ) . mockReturnValueOnce ( [ ] )
258
+ const tr1 = new TsJestTransformer ( )
259
+ const cacheKey2 = tr1 . getCacheKey ( input . fileContent , input . fileName , transformOptionsWithCache )
260
+
261
+ expect ( TsJestCompiler . prototype . getResolvedModules ) . toHaveBeenCalledTimes ( 1 )
262
+ expect ( TsJestCompiler . prototype . getResolvedModules ) . toHaveBeenCalledWith (
263
+ input . fileContent ,
264
+ input . fileName ,
265
+ new Map ( ) ,
266
+ )
267
+ expect ( cacheKey1 ) . not . toEqual ( cacheKey2 )
268
+ } )
269
+
245
270
test ( 'should be different with different file content for the same file' , ( ) => {
246
271
jest . spyOn ( TsJestCompiler . prototype , 'getResolvedModules' ) . mockReturnValueOnce ( [ ] )
247
272
0 commit comments