Created
March 23, 2023 07:40
-
-
Save exoego/ddd68273097093ed4831a9219ad55307 to your computer and use it in GitHub Desktop.
How to ignore AWS::Lambda::Version with jest-cdk-snapshot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from "aws-cdk-lib"; | |
export function getSubsetResourceTypes(stack: cdk.Stack): string[] { | |
const subResources = stack.node.children.map((child) => child.node.defaultChild as unknown as cdk.CfnResource | undefined); | |
return subResources.map((sub) => sub?.cfnResourceType).filter((t) => t !== undefined) as string[]; | |
} | |
expect(lambdaStack).toMatchCdkSnapshot({ | |
ignoreAssets: true, | |
subsetResourceTypes: getSubsetResourceTypes(stack.lambda).filter((t) => t !== "AWS::Lambda::Version"), | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment