Skip to content

Commit 35757f5

Browse files
committed
tests: add tolerant diffing for snapshot image assertions
1 parent ecbb206 commit 35757f5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Tests/TextDiffTests/SnapshotTestSupport.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import SnapshotTesting
33
import SwiftUI
44
import TextDiff
55

6+
private let snapshotPrecision: Float = 0.995
7+
private let snapshotPerceptualPrecision: Float = 0.98
8+
69
@MainActor
710
func assertTextDiffSnapshot(
811
original: String,
@@ -35,7 +38,10 @@ func assertTextDiffSnapshot(
3538

3639
assertSnapshot(
3740
of: snapshotImage,
38-
as: .image,
41+
as: .image(
42+
precision: snapshotPrecision,
43+
perceptualPrecision: snapshotPerceptualPrecision
44+
),
3945
named: name,
4046
fileID: fileID,
4147
file: filePath,

0 commit comments

Comments
 (0)