@@ -27,9 +27,9 @@ function createHtmlGenerator(data: DataFixture, debug = false) {
2727 const command = data . command ;
2828 const raw = data ;
2929 const testCaseStates = {
30- before : data . initialState ,
30+ before : { ... data . initialState , documentContents : data . initialState . documentContents ?? "" , stepName : "before" } ,
3131 during : getDuringSnapshot ( data ) ,
32- after : data . finalState
32+ after : { ... data . finalState , documentContents : data . finalState ?. documentContents ?? "" , stepName : "after" } ,
3333 } ;
3434
3535 /**
@@ -44,7 +44,7 @@ function createHtmlGenerator(data: DataFixture, debug = false) {
4444 if ( debug ) { console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ; }
4545 return "Error" ;
4646 }
47- const extendedState = { ...state , stepName } ;
47+ const extendedState = { ...state , stepName, selections : state . selections ?? [ ] } ;
4848 const decorations = await getDecorations ( { snapshot : extendedState , command } ) ;
4949 const { documentContents } = state ;
5050 const htmlArray : string [ ] = [ ] ;
@@ -105,7 +105,8 @@ function getDuringSnapshot(data: DataFixture): ExtendedTestCaseSnapshot {
105105 ? data . finalState
106106 : data . initialState ;
107107 // Exclude sourceMark and thatMark from the DURING snapshot
108- const { sourceMark, thatMark, ...restBase } = base ;
108+ const { sourceMark, thatMark, ...restBase } = base ?? { } ;
109+ // Ensure stepName is set on the snapshot
109110 return {
110111 ...restBase ,
111112 ...data . ide ,
0 commit comments