Open simondelphia opened 2 years ago
Hello @simondelphia, I got the same error, please check if *.png files are ok, in my case my was corrupted.
Yes they are corrupted. The cause of my issue has nothing to do with this library, so I didn't get into the details. Just would be nice if the library failed more gracefully.
@simondelphia But do you know how you resolved this issue?
@nhaarman @simondelphia @niemmi-gs Check if you have lfs configured. In my case it was the reason of the problem. I had to install them on CI
Yes iirc this was a case of something going wrong with git lfs. Git LFS was installed and working fine in most cases though. My point with raising this GitHub issue however was that the library ought not to force unwrap like this and instead should fail gracefully in this case.
I don't remember exactly what we did to fix it. I know at one point we were trying to set up Xcode Cloud and we might have seen this because the test bundle didn't actually have access to the bundled files without some special workarounds we had to implement. But I'm sure we also saw this in other cases where there was just some problem with loading some images occasionally. In some cases someone may have failed to properly commit the file, in other cases it might have just been a problem with the runner failing to properly download the image etc.
Occasionally getting an error on CI
This is referring to a line here: https://github.com/pointfreeco/swift-snapshot-testing/blob/main/Sources/SnapshotTesting/Snapshotting/UIImage.swift
Which has some force unwraps.
I'm not sure why this is happening — possibly not even related to this repo.
But instead of force unwrapping and leading to a fatal error, this could presumably be handled more gracefully instead.