@@ -189,31 +189,29 @@ export class TsJestTransformer implements SyncTransformer {
189189 ) : Promise < TransformedSource > {
190190 this . _logger . debug ( { fileName : sourcePath , transformOptions } , 'processing' , sourcePath )
191191
192- return new Promise ( async ( resolve , reject ) => {
193- const configs = this . _configsFor ( transformOptions )
194- const shouldStringifyContent = configs . shouldStringifyContent ( sourcePath )
195- const babelJest = shouldStringifyContent ? undefined : configs . babelJestTransformer
196- let result : TransformedSource
197- const processWithTsResult = this . processWithTs ( sourceText , sourcePath , transformOptions )
198- result = {
199- code : processWithTsResult . code ,
200- }
201- if ( processWithTsResult . diagnostics ?. length ) {
202- reject ( configs . createTsError ( processWithTsResult . diagnostics ) )
203- }
204- if ( babelJest ) {
205- this . _logger . debug ( { fileName : sourcePath } , 'calling babel-jest processor' )
192+ const configs = this . _configsFor ( transformOptions )
193+ const shouldStringifyContent = configs . shouldStringifyContent ( sourcePath )
194+ const babelJest = shouldStringifyContent ? undefined : configs . babelJestTransformer
195+ let result : TransformedSource
196+ const processWithTsResult = this . processWithTs ( sourceText , sourcePath , transformOptions )
197+ result = {
198+ code : processWithTsResult . code ,
199+ }
200+ if ( processWithTsResult . diagnostics ?. length ) {
201+ throw configs . createTsError ( processWithTsResult . diagnostics )
202+ }
203+ if ( babelJest ) {
204+ this . _logger . debug ( { fileName : sourcePath } , 'calling babel-jest processor' )
206205
207- // do not instrument here, jest will do it anyway afterwards
208- result = await babelJest . processAsync ( result . code , sourcePath , {
209- ...transformOptions ,
210- instrument : false ,
211- } )
212- }
213- result = this . runTsJestHook ( sourcePath , sourceText , transformOptions , result )
206+ // do not instrument here, jest will do it anyway afterwards
207+ result = await babelJest . processAsync ( result . code , sourcePath , {
208+ ...transformOptions ,
209+ instrument : false ,
210+ } )
211+ }
212+ result = this . runTsJestHook ( sourcePath , sourceText , transformOptions , result )
214213
215- resolve ( result )
216- } )
214+ return result
217215 }
218216
219217 private processWithTs (
0 commit comments