Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose snapshotDirectory parameter in assertSnapshot methods #934

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Sources/SnapshotTesting/AssertSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public var __record: SnapshotTestingConfiguration.Record = {
/// - snapshotting: A strategy for serializing, deserializing, and comparing values.
/// - name: An optional description of the snapshot.
/// - recording: Whether or not to record a new reference.
/// - snapshotDirectory: Optional directory to save snapshots. By default snapshots will be saved
/// in a directory with the same name as the test file, and that directory will sit inside a
/// - timeout: The amount of time a snapshot must be generated in.
/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in
/// which this function was called.
Expand All @@ -104,6 +106,7 @@ public func assertSnapshot<Value, Format>(
as snapshotting: Snapshotting<Value, Format>,
named name: String? = nil,
record recording: Bool? = nil,
snapshotDirectory: String? = nil,
timeout: TimeInterval = 5,
fileID: StaticString = #fileID,
file filePath: StaticString = #filePath,
Expand All @@ -116,6 +119,7 @@ public func assertSnapshot<Value, Format>(
as: snapshotting,
named: name,
record: recording,
snapshotDirectory: snapshotDirectory,
timeout: timeout,
fileID: fileID,
file: filePath,
Expand All @@ -140,6 +144,8 @@ public func assertSnapshot<Value, Format>(
/// - strategies: A dictionary of names and strategies for serializing, deserializing, and
/// comparing values.
/// - recording: Whether or not to record a new reference.
/// - snapshotDirectory: Optional directory to save snapshots. By default snapshots will be saved
/// in a directory with the same name as the test file, and that directory will sit inside a
/// - timeout: The amount of time a snapshot must be generated in.
/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in
/// which this function was called.
Expand All @@ -155,6 +161,7 @@ public func assertSnapshots<Value, Format>(
of value: @autoclosure () throws -> Value,
as strategies: [String: Snapshotting<Value, Format>],
record recording: Bool? = nil,
snapshotDirectory: String? = nil,
timeout: TimeInterval = 5,
fileID: StaticString = #fileID,
file filePath: StaticString = #filePath,
Expand All @@ -168,6 +175,7 @@ public func assertSnapshots<Value, Format>(
as: strategy,
named: name,
record: recording,
snapshotDirectory: snapshotDirectory,
timeout: timeout,
fileID: fileID,
file: filePath,
Expand All @@ -184,6 +192,8 @@ public func assertSnapshots<Value, Format>(
/// - value: A value to compare against a reference.
/// - strategies: An array of strategies for serializing, deserializing, and comparing values.
/// - recording: Whether or not to record a new reference.
/// - snapshotDirectory: Optional directory to save snapshots. By default snapshots will be saved
/// in a directory with the same name as the test file, and that directory will sit inside a
/// - timeout: The amount of time a snapshot must be generated in.
/// - fileID: The file ID in which failure occurred. Defaults to the file ID of the test case in
/// which this function was called.
Expand All @@ -199,6 +209,7 @@ public func assertSnapshots<Value, Format>(
of value: @autoclosure () throws -> Value,
as strategies: [Snapshotting<Value, Format>],
record recording: Bool? = nil,
snapshotDirectory: String? = nil,
timeout: TimeInterval = 5,
fileID: StaticString = #fileID,
file filePath: StaticString = #filePath,
Expand All @@ -211,6 +222,7 @@ public func assertSnapshots<Value, Format>(
of: try value(),
as: strategy,
record: recording,
snapshotDirectory: snapshotDirectory,
timeout: timeout,
fileID: fileID,
file: filePath,
Expand Down