Skip to content

Commit 9d7cb88

Browse files
committed
Add comment variable to expectation class
1 parent 3aa2744 commit 9d7cb88

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111
tools/*
1212
!tools/*.ts
1313
**/.aws-cfn-storage
14-
/oss-attribution
14+
/oss-attribution

tst/utils/TemplateBuilder.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function expectAt(actual: any, position: Position, description?: string) {
3434

3535
class Expectation {
3636
public todo: boolean = false;
37+
public todoComment?: string;
3738
}
3839

3940
class 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

Comments
 (0)