From 0f672b562cc073acf5aa7553539fc86bf0b02e67 Mon Sep 17 00:00:00 2001 From: Jakub Kiermasz Date: Fri, 13 Dec 2024 10:51:20 +0100 Subject: [PATCH] Add difftool to verifySnapshot --- Sources/SnapshotTesting/AssertSnapshot.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/SnapshotTesting/AssertSnapshot.swift b/Sources/SnapshotTesting/AssertSnapshot.swift index fefe1e6f7..cdd629842 100644 --- a/Sources/SnapshotTesting/AssertSnapshot.swift +++ b/Sources/SnapshotTesting/AssertSnapshot.swift @@ -261,6 +261,7 @@ public func assertSnapshots( /// - 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. @@ -277,6 +278,7 @@ public func verifySnapshot( as snapshotting: Snapshotting, named name: String? = nil, record recording: Bool? = nil, + diffTool: SnapshotTestingConfiguration.DiffTool? = nil, snapshotDirectory: String? = nil, timeout: TimeInterval = 5, fileID: StaticString = #fileID, @@ -291,7 +293,7 @@ public func verifySnapshot( (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