Skip to content

Commit abd7f7a

Browse files
stephencelisniilohlin
authored andcommitted
Better surface diff tool configuration (pointfreeco#469)
* Update README.md * Update AssertSnapshot.swift * Update AssertSnapshot.swift
1 parent 77c3739 commit abd7f7a

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ end
195195
- **Supports any platform that supports Swift.** Write snapshot tests for iOS, Linux, macOS, and tvOS.
196196
- **SceneKit, SpriteKit, and WebKit support.** Most snapshot testing libraries don't support these view subclasses.
197197
- **`Codable` support**. Snapshot encodable data structures into their [JSON](Documentation/Available-Snapshot-Strategies.md#json) and [property list](Documentation/Available-Snapshot-Strategies.md#plist) representations.
198-
- **Custom diff tool integration**.
198+
- **Custom diff tool integration**. Configure failure messages to print diff commands for [Kaleidoscope](https://kaleidoscope.app) (or your diff tool of choice).
199+
``` swift
200+
SnapshotTesting.diffTool = "ksdiff"
201+
```
199202

200203
## Plug-ins
201204

Sources/SnapshotTesting/AssertSnapshot.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,16 @@ public func verifySnapshot<Value, Format>(
288288

289289
let diffMessage = diffTool
290290
.map { "\($0) \"\(snapshotFileUrl.path)\" \"\(failedSnapshotFileUrl.path)\"" }
291-
?? "@\(minus)\n\"\(snapshotFileUrl.path)\"\n@\(plus)\n\"\(failedSnapshotFileUrl.path)\""
291+
?? """
292+
@\(minus)
293+
"\(snapshotFileUrl.path)"
294+
@\(plus)
295+
"\(failedSnapshotFileUrl.path)"
296+
297+
To configure output for a custom diff tool, like Kaleidoscope:
298+
299+
SnapshotTesting.diffTool = "ksdiff"
300+
"""
292301
return """
293302
Snapshot does not match reference.
294303

0 commit comments

Comments
 (0)