Skip to content

Commit bae6791

Browse files
committed
make sure we debug any output, even on failure
1 parent f77f1f2 commit bae6791

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

CodewarsBaseSpec.cfc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ component extends="testbox.system.BaseSpec" {
33
* @aroundEach
44
*/
55
function captureOutput( spec, suite ){
6-
savecontent variable="local.out" {
7-
arguments.spec.body();
8-
}
9-
if( len( trim( local.out ) ) ) {
10-
debug( local.out )
11-
}
6+
var out = '';
7+
savecontent variable="local.out" {
8+
try{
9+
arguments.spec.body();
10+
} catch( any e ) {
11+
var thisFailure = e;
12+
}
13+
}
14+
// make sure we debug any output, even on failure
15+
if( len( trim( local.out ) ) ) {
16+
debug( local.out )
17+
}
18+
if( !isNull( thisFailure ) ) {
19+
throw( thisFailure );
20+
}
1221
}
13-
22+
1423
}

0 commit comments

Comments
 (0)