@@ -34,6 +34,7 @@ function expectAt(actual: any, position: Position, description?: string) {
3434
3535class Expectation {
3636 public todo : boolean = false ;
37+ public todoComment ?: string ;
3738}
3839
3940class ContextExpectation extends Expectation {
@@ -152,7 +153,11 @@ export class TemplateBuilder {
152153 }
153154
154155 if ( step . verification ?. expectation ?. todo === true && exception === undefined ) {
155- throw new Error ( `TODO did not throw exception${ step . description ? ` - ${ step . description } ` : '' } ` ) ;
156+ const todoComment = step . verification . expectation . todoComment ;
157+ const commentSuffix = todoComment ? ` - TODO: ${ todoComment } ` : '' ;
158+ throw new Error (
159+ `TODO did not throw exception${ step . description ? ` - ${ step . description } ` : '' } ${ commentSuffix } ` ,
160+ ) ;
156161 } else if ( step . verification ?. expectation ?. todo === false && exception !== undefined ) {
157162 throw new Error ( `${ extractErrorMessage ( exception ) } ${ step . description ? ` - ${ step . description } ` : '' } ` ) ;
158163 }
@@ -773,6 +778,7 @@ export class ContextExpectationBuilder {
773778
774779 todo ( comment : string ) : ContextExpectationBuilder {
775780 this . expectation . todo = true ;
781+ this . expectation . todoComment = comment ;
776782 this . log . debug ( comment ) ;
777783 return this ;
778784 }
@@ -843,6 +849,7 @@ export class HoverExpectationBuilder {
843849
844850 todo ( comment : string ) : HoverExpectationBuilder {
845851 this . expectation . todo = true ;
852+ this . expectation . todoComment = comment ;
846853 this . log . debug ( comment ) ;
847854 return this ;
848855 }
@@ -897,6 +904,7 @@ export class CompletionExpectationBuilder {
897904
898905 todo ( comment : string ) : CompletionExpectationBuilder {
899906 this . expectation . todo = true ;
907+ this . expectation . todoComment = comment ;
900908 this . log . debug ( comment ) ;
901909 return this ;
902910 }
0 commit comments