@gammarer/jest-serializer-aws-cdk-asset-filename-replacer
TypeScript icon, indicating that this package has built-in type declarations

0.4.30 • Public • Published

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();

Package Sidebar

Install

npm i @gammarer/jest-serializer-aws-cdk-asset-filename-replacer

Weekly Downloads

32

Version

0.4.30

License

Apache-2.0

Unpacked Size

16.5 kB

Total Files

6

Last publish

Collaborators

  • yicr