@@ -24,6 +24,39 @@ describe.skipIf(process.platform === "win32")("native multi-invocation report ow
2424 const dirs = useAutoCleanupTempDirTracker ( afterEach ) ;
2525 const run = ( mode : ReportFixtureMode ) => createVitestReportFixture ( dirs . make ( "oc-report-" ) ) ( mode ) ;
2626
27+ it . each ( [
28+ [ "serial" , "projects" , false , "SIGABRT" , 134 ] ,
29+ [ "parallel" , "projects" , false , "SIGABRT" , 134 ] ,
30+ [ "serial" , undefined , false , "SIGABRT" , 134 ] ,
31+ [ "parallel" , undefined , false , "SIGABRT" , 134 ] ,
32+ [ "serial" , "projects" , true , "SIGABRT" , 134 ] ,
33+ [ "parallel" , "projects" , true , "SIGABRT" , 134 ] ,
34+ [ "parallel" , "projects" , true , "SIGKILL" , 137 ] ,
35+ ] as const ) (
36+ "preserves shard crashes: %s entry=%s report=%s signal=%s" ,
37+ { timeout : 60000 } ,
38+ async ( mode , entry , report , crashSignal , exitCode ) => {
39+ const result = await createVitestReportFixture ( dirs . make ( "oc-report-crash-" ) ) ( mode , {
40+ entry,
41+ report,
42+ crashSignal,
43+ } ) ;
44+ expect ( result . code !== 0 || result . signal !== null , result . stderr ) . toBe ( true ) ;
45+ expect ( result . signal === crashSignal || result . code === exitCode , result . stderr ) . toBe ( true ) ;
46+ expect ( result . stderr ) . not . toMatch ( / \[ t e s t \] p a s s e d / u) ;
47+ expect ( result . stderr . trimEnd ( ) . split ( "\n" ) . at ( - 1 ) ) . toBe ( `[test] FAILED (exit ${ exitCode } )` ) ;
48+ if ( report ) {
49+ const index = json ( path . join ( result . reportSet ! , "index.json" ) ) ;
50+ expect ( index . complete ) . toBe ( false ) ;
51+ expect ( index . entries [ 0 ] . attempts [ 0 ] . outcome ) . toMatchObject ( {
52+ code : exitCode ,
53+ signal : crashSignal ,
54+ } ) ;
55+ expect ( fs . existsSync ( result . output ) ) . toBe ( false ) ;
56+ }
57+ } ,
58+ ) ;
59+
2760 it . each ( [
2861 "serial" ,
2962 "parallel" ,
0 commit comments