Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add difftool to verifySnapshot #933

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/SnapshotTesting/AssertSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ public func assertSnapshots<Value, Format>(
/// - snapshotting: A strategy for serializing, deserializing, and comparing values.
/// - name: An optional description of the snapshot.
/// - recording: Whether or not to record a new reference.
/// - diffTool: The diff tool to use while asserting snapshots.
/// - snapshotDirectory: Optional directory to save snapshots. By default snapshots will be saved
/// in a directory with the same name as the test file, and that directory will sit inside a
/// directory `__Snapshots__` that sits next to your test file.
Expand All @@ -277,6 +278,7 @@ public func verifySnapshot<Value, Format>(
as snapshotting: Snapshotting<Value, Format>,
named name: String? = nil,
record recording: Bool? = nil,
diffTool: SnapshotTestingConfiguration.DiffTool? = nil,
snapshotDirectory: String? = nil,
timeout: TimeInterval = 5,
fileID: StaticString = #fileID,
Expand All @@ -291,7 +293,7 @@ public func verifySnapshot<Value, Format>(
(recording == true ? .all : recording == false ? .missing : nil)
?? SnapshotTestingConfiguration.current?.record
?? _record
return withSnapshotTesting(record: record) { () -> String? in
return withSnapshotTesting(record: record, diffTool: diffTool) { () -> String? in
do {
let fileUrl = URL(fileURLWithPath: "\(filePath)", isDirectory: false)
let fileName = fileUrl.deletingPathExtension().lastPathComponent
Expand Down