-
Notifications
You must be signed in to change notification settings - Fork 4.4k
(assertions): Add ability to read Annotations #18347
Copy link
Copy link
Closed
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1
Description
Description
Add the ability to read and validate against Annotations with the the assertions
Use Case
The @aws-cdk/assert module has the ability to read messages of stack using SynthUtils. This is helpful when trying to validate that there are no errors/warnings in the stack, especially when using Aspects to apply annotations
test('Example', () => {
const stack = new Stack();
// Aspects.of(stack).add(new MyAspect());
Annotations.of(stack).addError('MyError')
const messages = SynthUtils.synthesize(stack).messages;
expect(messages).not.toContainEqual(
expect.objectContaining({
entry: expect.objectContaining({
data: expect.stringContaining(
'MyError',
),
}),
}),
);
});Proposed Solution
It would be nice to have something like
assertions.Annotations.of(stack)
assertions.Annotations.of(app)
Other information
No response
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/assertionsRelated to the @aws-cdk/assertv2 packageRelated to the @aws-cdk/assertv2 packageeffort/mediumMedium work item – several days of effortMedium work item – several days of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1