@gammarer/jest-serializer-aws-cdk-asset-filename-replacer
v0.4.30
Published
this package is aws cdk construct asset filename replacer(RandomString.zip to HASH.zip)
Downloads
260
Readme
Jest serializer aws cdk asset filename replacer
Jest AWS CDK Constru this package is aws cdk construct asset filename replacer(RandomString.zip to HASH.zip)
Installation
npm install --save-dev @gammarer/jest-serializer-aws-cdk-asset-filename-replacer
Usage
You need to tell Jest to use the serializer. Add this to your Jest config:
"snapshotSerializers": [
"<rootDir>/node_modules/@gammarer/jest-serializer-aws-cdk-asset-filename-replacer"
]
or add this projenrc.ts
jestOptions: {
jestConfig: {
snapshotSerializers: ['<rootDir>/node_modules/@gammarer/jest-serializer-aws-cdk-asset-filename-replacer']
}
}
And your test.
const stack = new Stack(app, 'TestingStack');
new lambda.Function(stack, 'Function', {
runtime: lambda.Runtime.NODEJS_18_X,
code: lambda.Code.fromAsset(path.join(__dirname, '../asset/sample-func')),
handler: 'index.lambda_handler',
});
const template = Template.fromStack(stack);
expect(template.toJSON()).toMatchSnapshot();