@@ -23,9 +23,11 @@ component {
2323 }
2424 }
2525
26+ var debugMap = prepareDebugBuffer ( this Bundle .debugBuffer );
27+
2628 // Generate reports for each suite
2729 for ( var suiteStats in this Bundle .suiteStats ) {
28- genSuiteReport ( suiteStats = suiteStats , bundleStats = this Bundle , print = print );
30+ genSuiteReport ( suiteStats = suiteStats , bundleStats = this Bundle , print = print , debugMap = debugMap );
2931 }
3032 }
3133 }
@@ -36,16 +38,24 @@ component {
3638 * @bundleStats Bundle stats
3739 * @print The print Buffer
3840 */
39- function genSuiteReport ( required suiteStats , required bundleStats , required print ){
41+ function genSuiteReport ( required suiteStats , required bundleStats , required print , debugMap = {}, labelPrefix = ' ' ){
42+ labelPrefix & = ' /' & arguments .suiteStats .name ;
4043 print .line ( prependLF ( " <DESCRIBE::>#arguments .suiteStats .name #" ) );
4144
4245 for ( local .this Spec in arguments .suiteStats .specStats ) {
46+ var this SpecLabel = labelPrefix & ' /' & local .this Spec .name ;
4347 print .line ( prependLF ( " <IT::>#local .this Spec .name #" ) );
4448
49+ if ( debugMap .keyExists ( this SpecLabel ) ) {
50+ print .line ( debugMap [ this SpecLabel ] )
51+ }
52+
4553 if ( local .this Spec .status == " passed" ) {
4654 print .line ( prependLF ( " <PASSED::>Test Passed" ) );
4755 } else if ( local .this Spec .status == " failed" ) {
4856 print .line ( prependLF ( " <FAILED::>#escapeLF ( local .this Spec .failMessage ) #" ) );
57+ } else if ( local .this Spec .status == " skipped" ) {
58+ print .line ( prependLF ( " <FAILED::>Test Skipped" ) );
4959 } else if ( local .this Spec .status == " error" ) {
5060 print .line ( prependLF ( " <ERROR::>#escapeLF ( local .this Spec .error .message ) #" ) );
5161
@@ -80,7 +90,7 @@ component {
8090 // Handle nested Suites
8191 if ( arguments .suiteStats .suiteStats .len () ) {
8292 for ( local .nestedSuite in arguments .suiteStats .suiteStats ) {
83- genSuiteReport ( local .nestedSuite , arguments .bundleStats , print )
93+ genSuiteReport ( local .nestedSuite , arguments .bundleStats , print , debugMap , labelPrefix )
8494 }
8595 }
8696
@@ -95,4 +105,14 @@ component {
95105 return " #chr ( 10 ) ##text #" ;
96106 }
97107
108+ // Transofrm array of messages to struct keyed on message label containing an array of
109+ private function prepareDebugBuffer ( array debugBuffer ) {
110+ return debugBuffer .reduce ( ( debugMap = {}, d )= > {
111+ debugMap [ d .label ] = debugMap [ d .label ] ?: ' ' ;
112+ debugMap [ d .label ] & = prependLF ( isSimpleValue ( d .data ) ? d .data : serialize ( d .data ) );
113+ return debugMap ;
114+ } ) ?: {};
115+
116+ }
117+
98118}
0 commit comments