guardian / typerighter

Even if you’re the right typer, couldn’t hurt to use Typerighter!
Apache License 2.0
276 stars 12 forks source link

Improve CDK jest testing #456

Closed samanthagottlieb closed 1 year ago

samanthagottlieb commented 1 year ago

What does this change?

This PR makes a couple of changes to how we're testing CDK changes:

Firstly, this adds a test step to the CI workflow. Previously changes could be made to the CDK template and CI would pass without having updated the jest snapshot. Adding this step to CI will ensure that we're updating the snapshot when raising a PR. This will help us to have more confidence that we're making the infrastructure changes we intend to, and will enable PR reviewers to more easily see what changes are being made. I have also added a test:update npm script to make it easier to update the jest snapshot.

Secondly, this adds a noEmit flag to the typescript compiler config to prevent the compiler from outputting any transpiled javascript code. I was getting an error when trying to update the jest snapshot as it was comparing to generated javascript files rather than typescript files.

This PR also includes an updated jest snapshot, as it was out of date.

How to test

This can be tested by:

To check that CDK is being tested as part of CI, you can view the cdk synth step in the logs for this branch here.