terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Add Snapshot testing support for languages other than Typescript

Open Maed223 opened this issue 2 years ago • 0 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently Snapshot testing is only available in Typescript. To my understanding this current method of snapshot testing in Typescript is not extensible to other supported languages as it is reliant on jest's functionality. I myself see two paths forward to extending this capability.

Leverage existing Snapshot testing frameworks available in each language

The main issue here being that the snapshot testing frameworks vary in level of maturity depending on the language– see the referenced links for some below. Yet, from what I've seen most would require no added work on our end as they could simply consume the json config returned by Testing.synth(STACK) to both create and check against snapshots. Depending on the maturity of each of the frameworks they could be referenced in documentation to expose users to the potential ability.

Create our own unified solution

Similar to AWS CDK we could create a general solution for supported languages other than Typescript to then be exposed via JSII. This would be a much larger undertaking, as well as having the potential to be awkward as workflows for Snapshot testing between Typescript and other languages could differ quite greatly.

References

AWS CDK Snapshot Testing

Snapshot testing in Python

Snapshot testing in C#

Maed223 avatar Aug 04 '22 19:08 Maed223