Apparently, SnapshotTesting has this built-in. 🤦
While working with snapshot tests, it can be hard to debug what the problem is. This script allows you to quickly open the diff in a visual tool, Kaleidoscope, to compare the visual changes.
The output of SnapshotTesting when a snapshot doesn’t match looks like this:
@−
"/Users/soffes/Code/github/mobile-ios/Modules/GitHub/Tests/__Snapshots__/Foo/bar.png"
@+
"/Users/soffes/Library/Developer/CoreSimulator/Devices/FFD3D70A-435B-4FC8-A30C-11B42ADE6584/data/Containers/Data/Application/E898D96B-B0BC-451F-92AC-C7E722E5B347/tmp/Foo/bar.png"
Run this script with ruby snapshot_diff.rb
and paste in the diff from SnapshotTesting for it to open in Kaleidoscope. This requires that you have the ksdiff command line tool installed.
Enjoy.