chore: Make snapshot test fail when snapshot is empty #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
The snapshot test doesn't fail when a generated snapshot is empty. As a result, empty snapshots can be added for new stacks as "correct" snapshots, making the test unable to capture unexpected changes.
For example, #309 fixed an empty snapshot.
What does this PR do?
Make the snapshot fail if a snapshot is empty.
Testing Guidelines
Steps:
lambda-function-stack-legacy-datadog-api.ts
, change the stack name to something random, e.g.:so
lambda-function-stack-legacy-datadog-api.template.json
won't be generated and will be initialized as an empty file by the script.2. Run
aws-vault exec sso-serverless-sandbox-account-admin -- scripts/run_integration_tests.sh
Result: The test failed.
Additional Notes
Types of Changes
Check all that apply