Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer
https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer
- Owner: gammarers
- License: apache-2.0
- Created: 2023-01-26T08:49:17.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T16:30:57.000Z (3 months ago)
- Last Synced: 2024-10-20T00:19:10.229Z (3 months ago)
- Language: TypeScript
- Size: 1.66 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Jest aws cdk asset filename renamer
[![GitHub](https://img.shields.io/github/license/gammarers/jest-aws-cdk-asset-filename-renamer?style=flat-square)](https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer/blob/main/LICENSE)
[![npm (scoped)](https://img.shields.io/npm/v/@gammarers/jest-aws-cdk-asset-filename-renamer?style=flat-square)](https://www.npmjs.com/package/@gammarers/jest-aws-cdk-asset-filename-renamer)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/gammarers/jest-aws-cdk-asset-filename-renamer/release.yml?branch=main&label=release&style=flat-square)](https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer/actions/workflows/release.yml)
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/gammarers/jest-aws-cdk-asset-filename-renamer?sort=semver&style=flat-square)](https://github.com/gammarers/jest-aws-cdk-asset-filename-renamer/releases)this package is aws cdk construct asset filename renaming(RandomString.zip to HASH.zip)
## Installation
```shell
npm install --save-dev @gammarers/jest-aws-cdk-asset-filename-renamer
```## Usage
You need to tell Jest to use the serializer. Add this to your Jest config:```json
"snapshotSerializers": [
"/node_modules/@gammarers/jest-aws-cdk-asset-filename-renamer"
]
```
or add this projenrc.ts
```typescript
jestOptions: {
jestConfig: {
snapshotSerializers: ['/node_modules/@gammarers/jest-aws-cdk-asset-filename-renamer']
}
}
```And your test.
```typescript
const stack = new Stack(app, 'TestStack');
new lambda.Function(stack, 'Function', {
runtime: lambda.Runtime.NODEJS_22_X,
code: lambda.Code.fromAsset(path.join(__dirname, '../asset/sample-func')),
handler: 'index.lambda_handler',
});
const template = Template.fromStack(stack);
expect(template.toJSON()).toMatchSnapshot();
```