Skip to content

Assert package doesn't synthesize the stack #349

Description

@FizzBuzz791

If you follow the documentation for Fine-grained Assertions - the test will pass.

It's not a real-world scenario though - you don't create a resource in a test, you create the resource in the stack definition.

If you modify the test and move new dlq.DeadLetterQueue(...) inside of the new Stack() call (assuming new Stack() is a custom stack like export class MyStack extends Stack { ... }, the test will fail and indicate that there are 0 resources.


You can fix this error by adding a line; const stackTemplate = SynthUtils.toCloudFormation(new MyStack()) and passing the stackTemplate variable to the expect(...) call instead of the stack variable.

I'm not sure if this is a bug with the jest matcher though, or whether this fix is the right approach and the documentation just isn't quite matching up to a real-world scenario?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions