@@ -41,7 +41,9 @@ describe('TsCompiler', () => {
4141 const compiler = makeCompiler ( {
4242 tsJestConfig : {
4343 ...baseTsJestConfig ,
44- isolatedModules : true ,
44+ tsconfig : {
45+ isolatedModules : true ,
46+ } ,
4547 } ,
4648 } )
4749
@@ -111,7 +113,15 @@ describe('TsCompiler', () => {
111113 } ,
112114 ] ) ( 'should transpile code with config %p' , ( { useESM, babelConfig, supportsStaticESM } ) => {
113115 const compiler = makeCompiler ( {
114- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true , useESM, babelConfig } ,
116+ tsJestConfig : {
117+ ...baseTsJestConfig ,
118+ useESM,
119+ babelConfig,
120+ tsconfig : {
121+ isolatedModules : true ,
122+ customConditions : [ 'my-condition' ] ,
123+ } ,
124+ } ,
115125 } )
116126 const transformersStub = {
117127 before : [ ] ,
@@ -138,12 +148,19 @@ describe('TsCompiler', () => {
138148 module : usedCompilerOptions . module ,
139149 esModuleInterop : usedCompilerOptions . esModuleInterop ,
140150 allowSyntheticDefaultImports : usedCompilerOptions . allowSyntheticDefaultImports ,
151+ customConditions : usedCompilerOptions . customConditions ,
141152 } ) . toMatchSnapshot ( )
142153 } )
143154
144155 test . each ( [ true , false ] ) ( 'should report diagnostics if shouldReportDiagnostics is %p' , ( shouldReport ) => {
145156 const compiler = makeCompiler ( {
146- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true , useESM : false } ,
157+ tsJestConfig : {
158+ ...baseTsJestConfig ,
159+ useESM : false ,
160+ tsconfig : {
161+ isolatedModules : true ,
162+ } ,
163+ } ,
147164 } )
148165 compiler . configSet . raiseDiagnostics = jest . fn ( )
149166 compiler . configSet . shouldReportDiagnostics = jest . fn ( ) . mockReturnValue ( shouldReport )
@@ -227,6 +244,7 @@ describe('TsCompiler', () => {
227244 tsconfig : {
228245 module : moduleValue as unknown as RawCompilerOptions [ 'module' ] ,
229246 esModuleInterop : false ,
247+ customConditions : [ 'my-condition' ] ,
230248 } ,
231249 } ,
232250 } )
@@ -253,6 +271,7 @@ describe('TsCompiler', () => {
253271 expect ( usedCompilerOptions . module ) . toBe ( expectedModule )
254272 expect ( usedCompilerOptions . esModuleInterop ) . toBe ( expectedEsModuleInterop )
255273 expect ( usedCompilerOptions . moduleResolution ) . toBe ( ts . ModuleResolutionKind . Node10 )
274+ expect ( usedCompilerOptions . customConditions ) . toBeUndefined ( )
256275 expect ( output ) . toEqual ( {
257276 code : updateOutput ( jsOutput , fileName , sourceMap ) ,
258277 diagnostics : [ ] ,
@@ -355,7 +374,13 @@ describe('TsCompiler', () => {
355374 describe ( '_makeTransformers' , ( ) => {
356375 test ( 'should return the transformers object which contains before, after and afterDeclarations transformers' , ( ) => {
357376 const compiler = makeCompiler ( {
358- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true , useESM : false } ,
377+ tsJestConfig : {
378+ ...baseTsJestConfig ,
379+ useESM : false ,
380+ tsconfig : {
381+ isolatedModules : true ,
382+ } ,
383+ } ,
359384 } )
360385 const transformerStub = join ( mockFolder , 'dummy-transformer.js' )
361386 console . log = jest . fn ( )
@@ -395,7 +420,12 @@ describe('TsCompiler', () => {
395420 const fileName = join ( mockFolder , 'thing.ts' )
396421 const fileContent = 'const bar = 1'
397422 const compiler = makeCompiler ( {
398- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true } ,
423+ tsJestConfig : {
424+ ...baseTsJestConfig ,
425+ tsconfig : {
426+ isolatedModules : true ,
427+ } ,
428+ } ,
399429 } )
400430 const fileContentCache = new Map < string , string > ( )
401431 const fileVersionCache = new Map < string , number > ( )
0 commit comments