@@ -27,9 +27,9 @@ function createHtmlGenerator(data: DataFixture, debug = false) {
27
27
const command = data . command ;
28
28
const raw = data ;
29
29
const testCaseStates = {
30
- before : data . initialState ,
30
+ before : { ... data . initialState , documentContents : data . initialState . documentContents ?? "" , stepName : "before" } ,
31
31
during : getDuringSnapshot ( data ) ,
32
- after : data . finalState
32
+ after : { ... data . finalState , documentContents : data . finalState ?. documentContents ?? "" , stepName : "after" } ,
33
33
} ;
34
34
35
35
/**
@@ -44,7 +44,7 @@ function createHtmlGenerator(data: DataFixture, debug = false) {
44
44
if ( debug ) { console . error ( `Error in ${ stepName } ${ raw . command . spokenForm } ` ) ; }
45
45
return "Error" ;
46
46
}
47
- const extendedState = { ...state , stepName } ;
47
+ const extendedState = { ...state , stepName, selections : state . selections ?? [ ] } ;
48
48
const decorations = await getDecorations ( { snapshot : extendedState , command } ) ;
49
49
const { documentContents } = state ;
50
50
const htmlArray : string [ ] = [ ] ;
@@ -105,7 +105,8 @@ function getDuringSnapshot(data: DataFixture): ExtendedTestCaseSnapshot {
105
105
? data . finalState
106
106
: data . initialState ;
107
107
// 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
109
110
return {
110
111
...restBase ,
111
112
...data . ide ,
0 commit comments