@@ -138,13 +138,29 @@ function* runConfiguration(
138138 } ) ;
139139}
140140
141+ function configurationSucceeded ( run : {
142+ result : Result < Json > ;
143+ output : string ;
144+ results : readonly TestResult [ ] ;
145+ } ) : void {
146+ if ( ! run . result . ok || run . results . some ( ( entry ) => entry . status !== "pass" ) ) {
147+ throw new Error ( JSON . stringify ( {
148+ error : run . result . ok ? undefined : { message : run . result . error . message , stack : run . result . error . stack } ,
149+ output : run . output ,
150+ results : run . results ,
151+ } , ( _key , value ) => value instanceof Error ? { message : value . message , stack : value . stack } : value , 2 ) ) ;
152+ }
153+ }
154+
141155describe (
142156 "Session configuration through TestAgent" ,
143157 { sanitizeOps : false , sanitizeResources : false } ,
144158 ( ) => {
145159 it ( "runs configured Sessions and nested declarations through the source CLI and ACPX worker" , function * ( ) {
146160 const cli = yield * runCli ( [ "test" , DOC ] , RUN ) . join ( ) ;
147- expect ( cli . code ) . toBe ( 0 ) ;
161+ if ( cli . code !== 0 ) {
162+ throw new Error ( `SessionConfiguration CLI exited ${ cli . code } \nstdout:\n${ cli . stdout } \nstderr:\n${ cli . stderr } ` ) ;
163+ }
148164 expect ( cli . stdout ) . toContain ( "review deep" ) ;
149165 expect ( cli . stdout ) . not . toContain ( "ERROR" ) ;
150166 } ) ;
@@ -163,7 +179,7 @@ describe(
163179 it ( "retains named native identity, isolates Tests, and replays without a worker" , function * ( ) {
164180 const stream = new InMemoryStream ( ) ;
165181 const live = yield * runConfiguration ( stream , cliBase ( ) ) ;
166- expect ( live . result . ok ) . toBe ( true ) ;
182+ configurationSucceeded ( live ) ;
167183 expect ( live . results . map ( ( entry ) => entry . status ) ) . toEqual ( [
168184 "pass" ,
169185 "pass" ,
@@ -189,7 +205,7 @@ describe(
189205 const replay = yield * runConfiguration ( stream , [
190206 "/nonexistent/xmd-configuration-must-not-spawn" ,
191207 ] ) ;
192- expect ( replay . result . ok ) . toBe ( true ) ;
208+ configurationSucceeded ( replay ) ;
193209 expect ( replay . results . map ( ( entry ) => entry . status ) ) . toEqual (
194210 live . results . map ( ( entry ) => entry . status ) ,
195211 ) ;
0 commit comments