You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for .expectationFailed in interop and exit tests. (#1608)
This PR enhances the JSON event stream to allow us to recognize and
recover issues of kind `.expectationFailed`. This then improves the
fidelity of these issues when passed through XCTest interop and exit
test process boundaries.
For example, given the following exit test:
```swift
@test func foo() async {
await #expect(processExitsWith: .success) {
struct S: Equatable {
var x: Int
var y: String
}
let lhs = S(x: 1, y: "abc")
let rhs = S(x: 2, y: "def")
#expect(lhs == rhs)
}
}
```
We'll now get a breakdown of the failed expectation (note I recorded
this example with `--verbose` so type info would be visible too):
```
<X> Test foo() recorded an issue at [...]: Expectation failed: lhs == rhs
`-> lhs == rhs: Swift.Bool → false
`-> lhs: ModuleName.S → S(x: 1, y: "abc")
`-> x: Swift.Int → 1
`-> y: Swift.String → "abc"
`-> rhs: ModuleName.S → S(x: 2, y: "def")
`-> x: Swift.Int → 2
`-> y: Swift.String → "def"
```
In the process of implementing this change, I was able to reconcile the
issue-decoding logic used in interop and exit tests so they share an
implementation.
This PR also resolves an issue running interop tests inside Xcode 26.4
where the tests could spuriously fail.
### Checklist:
- [x] Code and documentation should follow the style of the [Style
Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md).
- [x] If public symbols are renamed or modified, DocC references should
be updated.
0 commit comments