Closed
Description
Describe the bug
I am running into an uncaught exception “Terminating app due to uncaught exception NSInternalInconsistencyException
, reason: Current context must not be nil
” when snapshot testing a string. The problem only occurs when the test fails. There is no problem at all when recording.
This is not an async test.
To Reproduce
Fresh new project
import Testing
import SnapshotTesting
struct SomeTests {
@Test
func this_test_crashes_when_assertion_fails() throws {
withSnapshotTesting {
assertSnapshot(of: "foo", as: .lines)
}
}
}
Expected behavior
Maybe I am missing something fundamental in the new snapshottesting setup, but this should not crash and I should get a diff in Xcode.
Screenshots
Similar screenshot as in #875
Environment
- swift-snapshot-testing version 1.17.5
- Xcode 16.0 (16A242d)
- Swift 6.0
- OS: macOS 15.0.1 (24A348)
Additional context
This is not an async test, so #822 and #875 solutions do not apply here
Thank you in advance for looking into this!
Metadata
Metadata
Assignees
Labels
No labels