Skip to content

Conversation

grynspan
Copy link
Contributor

@grynspan grynspan commented Sep 20, 2024

Hot on the heels of #697

If an exit test records an issue of kind .errorCaught(), we currently treat it the same as any other issue and translate it to a flat .unconditional issue in the parent process:

await #expect(exitsWith: .failure) {
  Issue.record(NoSuchWeaselError()) // unconditional issue recorded
}

This PR distinguishes the .errorCaught issue kind and records an .errorCaught issue in the parent process. Fidelity of errors across a process boundary is weak, but we encode a minimal representation of the error that should be good enough for most uses. If you need withKnownIssue(), or #expect(throws:), you can call them inside the exit test.

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

If an exit test records an issue of kind `.errorCaught()`, we currently treat it
the same as any other issue and translate it to a flat `.unconditional` issue in
the parent process:

```swift
await #expect(exitsWith: .failure) {
  Issue.record(NoSuchWeaselError()) // unconditional issue recorded
}
```

This PR distinguishes the `.errorCaught` issue kind and records an
`.errorCaught` issue in the parent process. Fidelity of errors across a process
boundary is weak, but we encode a minimal representation of the error that
should be good enough for most uses. If you need `withKnownIssue()`, or
`#expect(throws:)`, you can call them _inside_ the exit test.
@grynspan grynspan added enhancement New feature or request tools integration 🛠️ Integration of swift-testing into tools/IDEs exit-tests ☠️ Work related to exit tests issue-handling Related to Issue handling within the testing library labels Sep 20, 2024
@grynspan grynspan self-assigned this Sep 20, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan added this to the Swift 6.1 milestone Sep 24, 2024
@grynspan
Copy link
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 81c537c into main Sep 26, 2024
3 checks passed
@grynspan grynspan deleted the jgrynspan/distinguish-recorded-errors-from-other-issues-in-exit-tests branch September 26, 2024 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exit-tests ☠️ Work related to exit tests issue-handling Related to Issue handling within the testing library tools integration 🛠️ Integration of swift-testing into tools/IDEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants