Skip to content

Commit

Permalink
Configure isRecording default value with launch arguments (#862)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrapperon authored Jul 4, 2024
1 parent fa43e37 commit 172f441
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/SnapshotTesting/AssertSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ import XCTest
public var diffTool: String? = nil

/// Whether or not to record all new references.
public var isRecording = false
public var isRecording: Bool = {
let args = ProcessInfo.processInfo.arguments
if let index = args.firstIndex(of: "-co.pointfree.SnapshotTesting.IsRecording"),
index < args.count - 1,
args[index + 1] == "1"
{
return true
}
return false
}()

/// Whether or not to record all new references.
///
Expand Down

0 comments on commit 172f441

Please sign in to comment.