swift-snapshot-testing
swift-snapshot-testing copied to clipboard
Reduce reference images' file sizes
Just curious if anyone here uses any strategy to minimize the increase in repo size due to the reference images stored. For scrollable views I'm getting image sizes as big as 1.2MB, trying to find a way to minimize this. Tried to tinify the images but the diffing will fail because there are byte differences when images are tinified.
I think the default strategy for storage is to use PNG, which is lossless (as it needs to be), but is best at compressing large, flat color areas. If you have photos, you might consider replacing them (just when doing snapshot tests) with flat colors.
Another approach might be to snapshot small portions of your UI, rather than a whole screen at once.
Unfortunately, I think the file sizes that come with lossless compression are a cost of doing business with snapshot tests. :-P
Related: https://github.com/pointfreeco/swift-snapshot-testing/pull/467