diff --git a/Sources/SnapshotTesting/AssertSnapshot.swift b/Sources/SnapshotTesting/AssertSnapshot.swift index 11e76142..a5792d7a 100644 --- a/Sources/SnapshotTesting/AssertSnapshot.swift +++ b/Sources/SnapshotTesting/AssertSnapshot.swift @@ -331,7 +331,9 @@ public func verifySnapshot( snapshotFileUrl = snapshotFileUrl.appendingPathExtension(ext) } let fileManager = FileManager.default - try fileManager.createDirectory(at: snapshotDirectoryUrl, withIntermediateDirectories: true) + if !fileManager.fileExists(atPath: snapshotDirectoryUrl.path) { + try fileManager.createDirectory(at: snapshotDirectoryUrl, withIntermediateDirectories: true) + } let tookSnapshot = XCTestExpectation(description: "Took snapshot") var optionalDiffable: Format?