@@ -41,7 +41,9 @@ describe('TsCompiler', () => {
41
41
const compiler = makeCompiler ( {
42
42
tsJestConfig : {
43
43
...baseTsJestConfig ,
44
- isolatedModules : true ,
44
+ tsconfig : {
45
+ isolatedModules : true ,
46
+ } ,
45
47
} ,
46
48
} )
47
49
@@ -111,7 +113,15 @@ describe('TsCompiler', () => {
111
113
} ,
112
114
] ) ( 'should transpile code with config %p' , ( { useESM, babelConfig, supportsStaticESM } ) => {
113
115
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
+ } ,
115
125
} )
116
126
const transformersStub = {
117
127
before : [ ] ,
@@ -138,12 +148,19 @@ describe('TsCompiler', () => {
138
148
module : usedCompilerOptions . module ,
139
149
esModuleInterop : usedCompilerOptions . esModuleInterop ,
140
150
allowSyntheticDefaultImports : usedCompilerOptions . allowSyntheticDefaultImports ,
151
+ customConditions : usedCompilerOptions . customConditions ,
141
152
} ) . toMatchSnapshot ( )
142
153
} )
143
154
144
155
test . each ( [ true , false ] ) ( 'should report diagnostics if shouldReportDiagnostics is %p' , ( shouldReport ) => {
145
156
const compiler = makeCompiler ( {
146
- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true , useESM : false } ,
157
+ tsJestConfig : {
158
+ ...baseTsJestConfig ,
159
+ useESM : false ,
160
+ tsconfig : {
161
+ isolatedModules : true ,
162
+ } ,
163
+ } ,
147
164
} )
148
165
compiler . configSet . raiseDiagnostics = jest . fn ( )
149
166
compiler . configSet . shouldReportDiagnostics = jest . fn ( ) . mockReturnValue ( shouldReport )
@@ -227,6 +244,7 @@ describe('TsCompiler', () => {
227
244
tsconfig : {
228
245
module : moduleValue as unknown as RawCompilerOptions [ 'module' ] ,
229
246
esModuleInterop : false ,
247
+ customConditions : [ 'my-condition' ] ,
230
248
} ,
231
249
} ,
232
250
} )
@@ -253,6 +271,7 @@ describe('TsCompiler', () => {
253
271
expect ( usedCompilerOptions . module ) . toBe ( expectedModule )
254
272
expect ( usedCompilerOptions . esModuleInterop ) . toBe ( expectedEsModuleInterop )
255
273
expect ( usedCompilerOptions . moduleResolution ) . toBe ( ts . ModuleResolutionKind . Node10 )
274
+ expect ( usedCompilerOptions . customConditions ) . toBeUndefined ( )
256
275
expect ( output ) . toEqual ( {
257
276
code : updateOutput ( jsOutput , fileName , sourceMap ) ,
258
277
diagnostics : [ ] ,
@@ -355,7 +374,13 @@ describe('TsCompiler', () => {
355
374
describe ( '_makeTransformers' , ( ) => {
356
375
test ( 'should return the transformers object which contains before, after and afterDeclarations transformers' , ( ) => {
357
376
const compiler = makeCompiler ( {
358
- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true , useESM : false } ,
377
+ tsJestConfig : {
378
+ ...baseTsJestConfig ,
379
+ useESM : false ,
380
+ tsconfig : {
381
+ isolatedModules : true ,
382
+ } ,
383
+ } ,
359
384
} )
360
385
const transformerStub = join ( mockFolder , 'dummy-transformer.js' )
361
386
console . log = jest . fn ( )
@@ -395,7 +420,12 @@ describe('TsCompiler', () => {
395
420
const fileName = join ( mockFolder , 'thing.ts' )
396
421
const fileContent = 'const bar = 1'
397
422
const compiler = makeCompiler ( {
398
- tsJestConfig : { ...baseTsJestConfig , isolatedModules : true } ,
423
+ tsJestConfig : {
424
+ ...baseTsJestConfig ,
425
+ tsconfig : {
426
+ isolatedModules : true ,
427
+ } ,
428
+ } ,
399
429
} )
400
430
const fileContentCache = new Map < string , string > ( )
401
431
const fileVersionCache = new Map < string , number > ( )
0 commit comments