Skip to content

Commit 2d1ca9c

Browse files
author
Minho Yi
committed
Add in diffToolSuffix to support ImageMagick cli
1 parent a02ef9a commit 2d1ca9c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/SnapshotTesting/AssertSnapshot.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import XCTest
44
///
55
/// diffTool = "ksdiff"
66
public var diffTool: String? = nil
7+
public var diffToolSuffix: String = ""
78

89
/// Whether or not to record all new references.
910
public var isRecording = false
@@ -299,7 +300,7 @@ public func verifySnapshot<Value, Format>(
299300
}
300301

301302
let diffMessage = diffTool
302-
.map { "\($0) \"\(snapshotFileUrl.path)\" \"\(failedSnapshotFileUrl.path)\"" }
303+
.map { "\($0) \"\(snapshotFileUrl.path)\" \"\(failedSnapshotFileUrl.path)\" \(diffToolSuffix)" }
303304
?? """
304305
@\(minus)
305306
"\(snapshotFileUrl.path)"
@@ -309,6 +310,10 @@ public func verifySnapshot<Value, Format>(
309310
To configure output for a custom diff tool, like Kaleidoscope:
310311
311312
SnapshotTesting.diffTool = "ksdiff"
313+
314+
or ImageMagick:
315+
SnapshotTesting.diffTool = "magick compare"
316+
SnapshotTesting.diffToolSuffix = "diff.png && open diff.png"
312317
"""
313318

314319
let failureMessage: String

0 commit comments

Comments
 (0)