Skip to content

Commit f237e56

Browse files
committed
Update AssertSnapshot.swift
1 parent 7438026 commit f237e56

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Sources/SnapshotTesting/AssertSnapshot.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,11 @@ public func verifySnapshot<Value, Format>(
199199
}
200200

201201
let testName = sanitizePathComponent(testName)
202-
let snapshotFileUrl = snapshotDirectoryUrl
203-
.appendingPathComponent("\(testName).\(identifier)")
204-
.appendingPathExtension(snapshotting.pathExtension ?? "")
202+
let myBundle = Bundle(for: CleanCounterBetweenTestCases.self)
203+
let snapshotFileUrl = myBundle.path(forResource: "\(testName).\(identifier)", ofType: snapshotting.pathExtension)
204+
.map { URL(fileURLWithPath: $0) } ?? snapshotDirectoryUrl
205+
.appendingPathComponent("\(testName).\(identifier)")
206+
.appendingPathExtension(snapshotting.pathExtension ?? "")
205207
let fileManager = FileManager.default
206208
try fileManager.createDirectory(at: snapshotDirectoryUrl, withIntermediateDirectories: true)
207209

0 commit comments

Comments
 (0)