Describe the bug
Running a snapshot test repeatedly with xcode's new 'run test repeatedly' functionality results in additional snapshots being created for that test.
We've a wrapper around this library which I've posted below although the identifier we're passing in to the testName does not include the iteration number at the real testSnapshot callsite.
public func testSnapshot(_ view: UIView,
identifier: String = #function,
snapshotType: SnapshotType = .image,
precision: CGFloat = 0.95,
file: StaticString = #file,
line: UInt = #line,
waiting: TimeInterval = 0,
isArchitectureDependent: Bool = false) {
semaphore.wait()
var testID = identifier
if isArchitectureDependent && (Architecture.isArm64 || Architecture.isRosettaEmulated) {
testID.append("-arm64")
}
switch snapshotType {
case .image:
assertSnapshot(matching: view,
as: .wait(for: waiting, on: .image(precision: Float(precision))),
record: isRecording,
file: file,
testName: testID,
line: line)
case .recursiveDescription:
assertSnapshot(matching: view,
as: .wait(for: waiting, on: .recursiveDescription()),
record: isRecording,
file: file,
testName: testID,
line: line)
}
semaphore.signal()
}
To Reproduce
Take any snapshot test right click on it and run "test repeatedly". At a certain iteration a number matching this iteration (2 in the screenshots below) will be appended to the snapshot reference image name causing an additional snapshot to be saved and the tests to fail.


Expected behavior
I'd expect the test to use only one snapshot no matter how many time they're run.
Environment
- swift-snapshot-testing version [e.g. 1.8.1]
- Xcode 13.2
- Swift 5.5
- OS: iOS 15
Describe the bug
Running a snapshot test repeatedly with xcode's new 'run test repeatedly' functionality results in additional snapshots being created for that test.
We've a wrapper around this library which I've posted below although the identifier we're passing in to the testName does not include the iteration number at the real testSnapshot callsite.
To Reproduce

Take any snapshot test right click on it and run "test repeatedly". At a certain iteration a number matching this iteration (2 in the screenshots below) will be appended to the snapshot reference image name causing an additional snapshot to be saved and the tests to fail.
Expected behavior
I'd expect the test to use only one snapshot no matter how many time they're run.
Environment