@@ -89,7 +89,10 @@ const hostShim = {
8989function captureStderr < T > ( fn : ( ) => T ) : { result : T ; stderr : string } {
9090 const orig = process . stderr . write . bind ( process . stderr ) ;
9191 let buf = '' ;
92- ( process . stderr . write as any ) = ( chunk : any ) => { buf += String ( chunk ) ; return true ; } ;
92+ ( process . stderr . write as any ) = ( chunk : any ) => {
93+ buf += String ( chunk ) ;
94+ return true ;
95+ } ;
9396 try {
9497 const result = fn ( ) ;
9598 return { result, stderr : buf } ;
@@ -210,8 +213,12 @@ function captureStderr<T>(fn: () => T): { result: T; stderr: string } {
210213 } ) ;
211214 const valid = { version : inc . INCREMENTAL_STATE_VERSION , tsBuildInfoText : 'irrelevant' } ;
212215 const { result, stderr } = captureStderr ( ( ) => {
213- try { return inc . reconstructOldBuilder ( tsStub , valid , hostShim ) ; }
214- catch { return 'THREW' as const ; }
216+ try {
217+ return inc . reconstructOldBuilder ( tsStub , valid , hostShim ) ;
218+ }
219+ catch {
220+ return 'THREW' as const ;
221+ }
215222 } ) ;
216223 check ( 'missing load APIs → no throw' , result !== 'THREW' ) ;
217224 check ( 'missing load APIs → undefined result' , result === undefined ) ;
@@ -227,8 +234,12 @@ function captureStderr<T>(fn: () => T): { result: T; stderr: string } {
227234{
228235 const fakeBuilder = { } as ts . BuilderProgram ;
229236 const { result, stderr } = captureStderr ( ( ) => {
230- try { return inc . captureIncrementalState ( ts . version , fakeBuilder ) ; }
231- catch { return 'THREW' as const ; }
237+ try {
238+ return inc . captureIncrementalState ( ts . version , fakeBuilder ) ;
239+ }
240+ catch {
241+ return 'THREW' as const ;
242+ }
232243 } ) ;
233244 check ( 'missing emitBuildInfo → no throw' , result !== 'THREW' ) ;
234245 check ( 'missing emitBuildInfo → undefined state' , result === undefined ) ;
@@ -239,11 +250,17 @@ function captureStderr<T>(fn: () => T): { result: T; stderr: string } {
239250// ── Test 9: emitBuildInfo throws → undefined + warn, no throw out ──────
240251{
241252 const throwingBuilder = {
242- emitBuildInfo ( ) { throw new Error ( 'simulated TS internal failure' ) ; } ,
253+ emitBuildInfo ( ) {
254+ throw new Error ( 'simulated TS internal failure' ) ;
255+ } ,
243256 } as unknown as ts . BuilderProgram ;
244257 const { result, stderr } = captureStderr ( ( ) => {
245- try { return inc . captureIncrementalState ( ts . version , throwingBuilder ) ; }
246- catch { return 'THREW' as const ; }
258+ try {
259+ return inc . captureIncrementalState ( ts . version , throwingBuilder ) ;
260+ }
261+ catch {
262+ return 'THREW' as const ;
263+ }
247264 } ) ;
248265 check ( 'throwing emitBuildInfo → no throw' , result !== 'THREW' ) ;
249266 check ( 'throwing emitBuildInfo → undefined state' , result === undefined ) ;
@@ -261,15 +278,21 @@ function captureStderr<T>(fn: () => T): { result: T; stderr: string } {
261278 const throwingTs = new Proxy ( ts , {
262279 get ( target , prop ) {
263280 if ( prop === 'getBuildInfo' ) {
264- return ( ) => { throw new Error ( 'synthetic parse failure' ) ; } ;
281+ return ( ) => {
282+ throw new Error ( 'synthetic parse failure' ) ;
283+ } ;
265284 }
266285 return ( target as any ) [ prop ] ;
267286 } ,
268287 } ) ;
269288 const valid = { version : inc . INCREMENTAL_STATE_VERSION , tsBuildInfoText : 'whatever' } ;
270289 const { result, stderr } = captureStderr ( ( ) => {
271- try { return inc . reconstructOldBuilder ( throwingTs , valid , hostShim ) ; }
272- catch { return 'THREW' as const ; }
290+ try {
291+ return inc . reconstructOldBuilder ( throwingTs , valid , hostShim ) ;
292+ }
293+ catch {
294+ return 'THREW' as const ;
295+ }
273296 } ) ;
274297 check ( 'throwing getBuildInfo → no throw' , result !== 'THREW' ) ;
275298 check ( 'throwing getBuildInfo → undefined result' , result === undefined ) ;
@@ -307,8 +330,12 @@ function captureStderr<T>(fn: () => T): { result: T; stderr: string } {
307330 } ,
308331 } as unknown as ts . BuilderProgram ;
309332 const { result, stderr } = captureStderr ( ( ) => {
310- try { return inc . captureIncrementalState ( ts . version , oversizedBuilder ) ; }
311- catch { return 'THREW' as const ; }
333+ try {
334+ return inc . captureIncrementalState ( ts . version , oversizedBuilder ) ;
335+ }
336+ catch {
337+ return 'THREW' as const ;
338+ }
312339 } ) ;
313340 check ( 'oversized buildinfo → no throw' , result !== 'THREW' ) ;
314341 check ( 'oversized buildinfo → undefined state' , result === undefined ) ;
0 commit comments