Skip to content

Commit 1e8c8cf

Browse files
tgrapperonawaltzforvenus
authored andcommitted
Configure isRecording default value with launch arguments (pointfreeco#862)
1 parent 5607ebb commit 1e8c8cf

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Sources/SnapshotTesting/AssertSnapshot.swift

+10-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,16 @@ import XCTest
99
public var diffTool: String? = nil
1010

1111
/// Whether or not to record all new references.
12-
public var isRecording = false
12+
public var isRecording: Bool = {
13+
let args = ProcessInfo.processInfo.arguments
14+
if let index = args.firstIndex(of: "-co.pointfree.SnapshotTesting.IsRecording"),
15+
index < args.count - 1,
16+
args[index + 1] == "1"
17+
{
18+
return true
19+
}
20+
return false
21+
}()
1322

1423
/// Whether or not to record all new references.
1524
///

0 commit comments

Comments
 (0)