@@ -156,7 +156,7 @@ describe("formatStartupCrashReport", () => {
156156
157157 it ( "says so when nothing was recorded" , ( ) => {
158158 expect ( formatStartupCrashReport ( [ ] , { version : "1.1.1" , build : "56" } ) ) . toBe (
159- "T3 Code 1.1.1 (56)\nNo startup crashes recorded." ,
159+ "T3 Code 1.1.1 (56)\nNo crashes recorded." ,
160160 ) ;
161161 } ) ;
162162} ) ;
@@ -224,18 +224,41 @@ describe("persisted fatal JS diagnostics", () => {
224224 // Only disk survives a fresh module graph; recovery must not rely on logger memory.
225225 vi . resetModules ( ) ;
226226 const { readCrashRecords } = await import ( "./crash-log-model" ) ;
227- const records = readCrashRecords ( [ FATAL ] ) ;
227+ const startupDetail = [
228+ "Domain: RCTErrorDomain" ,
229+ `Description: Unhandled JS Exception: Error: ${ fatal . message } ` ,
230+ "" ,
231+ "This error is located at:" ,
232+ ` at NativeThreadBoundary (${ BUNDLE } :88:9)` ,
233+ ] . join ( "\n" ) ;
234+ const nearbyTimestamp = capturedAt . getTime ( ) + 50 ;
235+ const records = readCrashRecords ( [
236+ FATAL ,
237+ {
238+ ...FATAL ,
239+ timestamp : capturedAt . getTime ( ) + 33 ,
240+ message : `ErrorRecovery fatal exception: ${ startupDetail } ` ,
241+ } ,
242+ { ...FATAL , timestamp : nearbyTimestamp } ,
243+ ] ) ;
228244
229- expect ( records ) . toHaveLength ( 2 ) ;
245+ expect ( records ) . toHaveLength ( 3 ) ;
230246 expect ( records . map ( ( record ) => record . timestamp ) ) . toEqual ( [
247+ nearbyTimestamp ,
231248 capturedAt . getTime ( ) ,
232249 FATAL . timestamp ,
233250 ] ) ;
234- expect ( records [ 0 ] ?. description ) . toContain ( fatal . message ) ;
235- expect ( records [ 0 ] ?. detail ) . toContain ( fatal . stack ) ;
251+ expect ( records . map ( ( record ) => record . description ) ) . toEqual ( [
252+ "TypeError: Cannot read property 'defaultModelSelection' of null" ,
253+ `Error: ${ fatal . message } ` ,
254+ "TypeError: Cannot read property 'defaultModelSelection' of null" ,
255+ ] ) ;
256+ expect ( records [ 1 ] ?. detail ) . toContain ( fatal . stack ) ;
257+ expect ( records [ 1 ] ?. detail ) . toContain ( startupDetail ) ;
236258 const report = formatStartupCrashReport ( records , { version : "1.1.1" , build : "56" } ) ;
237259 expect ( report ) . toContain ( capturedAt . toISOString ( ) ) ;
238260 expect ( report ) . toContain ( fatal . stack ) ;
261+ expect ( report ) . toContain ( startupDetail ) ;
239262 expect ( report ) . toContain ( "defaultModelSelection" ) ;
240263 expect ( report ) . toContain ( "at NewTaskFlowProvider" ) ;
241264 } ) ;
@@ -258,7 +281,7 @@ describe("persisted fatal JS diagnostics", () => {
258281 expect ( previous ) . toHaveBeenLastCalledWith ( fatal , true ) ;
259282 expect ( previous . mock . calls . at ( - 1 ) ?. [ 0 ] ) . toBe ( fatal ) ;
260283 await Promise . allSettled ( disk . pendingWrites ) ;
261- expect ( [ ... disk . files . values ( ) ] . every ( ( content ) => content === "" ) ) . toBe ( true ) ;
284+ expect ( disk . files . size ) . toBe ( 0 ) ;
262285 }
263286 expect ( previous ) . toHaveBeenCalledTimes ( 3 ) ;
264287 } ) ;
0 commit comments