Closed
Description
Describe the bug
This commit changes the approach to detect if a snapshot is generated on the main thread. However, as discussed in GRDBSnapshotTests issue, this is a breaking change for certain code patterns.
To Reproduce
Download GRDBSnapshotTesting and add the following test case:
// Crash
func test_issue_5() throws {
let dbQueue = try DatabaseQueue()
try dbQueue.read { db in
assertSnapshot(of: "SELECT 'Hello, world!'", as: .dump(db))
}
}
Or:
// On the main thread
let queue = DispatchQueue(label: "test")
queue.sync {
print("Hello")
// Success: we're on the main thread
assert(Thread.isMainThread)
// assertSnapshot ...
}
Expected behavior
A snapshot is successfully recorded and generated
Environment
- swift-snapshot-testing version 1.18.0 and higher
- Xcode 16.2
- Swift 6
- OS: iOS 18
Metadata
Metadata
Assignees
Labels
No labels