Skip to content

Conversation

@stmontgomery
Copy link
Contributor

This merges the main branch into the release/6.2 branch.

Note: The Swift Testing project will be periodically performing "backwards" merges like this for a period which extends beyond the date when the 6.2 branches were cut, since nearly all contributions are intended to be included in the 6.2 release.

Once this PR has been merged, I will adjust the milestones on the PRs included in this merge to be 6.2 wherever appropriate.

Checklist:

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

stmontgomery and others added 7 commits April 24, 2025 12:43
Fix a small oversight in the URL of the CI status badge for Swift 6.1
Windows, which I added in swiftlang#1083. The URL points to the wrong CI server
domain, so it says "Not run" instead of "Passing".

### 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.
Add withKnownIssue comments to known Issues

### Motivation:

The Comment passed to withKnownIssue() is currently only used when a
known issue does not occur. When a known issue does occur, it is marked
isKnown but does not contain any record of the withKnownIssue() comment,
making it harder to understand why the issue was considered to be known,
especially if there are multiple nested withKnownIssue() calls.

### Modifications:

When an issue is marked "known" by a `withKnownIssue()` call, the
recorded issue will now have a new `knownIssueContext` property
containing the comment passed to `withKnownIssue()` (if any). This
comment will be included in the `messages` array of the
`ABI.EncodedEvent` that represents the issue.

If the issue is recorded within multiple nested `withKnownIssue()`
calls, `knownIssueContext` corresponds to the innermost matching call.

The `Issue.isKnown` setter is now deprecated and a no-op.

When an error is thrown within a `withKnownIssue()` call, the `Issue`
passed to the issue matcher used to have the known issue comment in
`Issue.comments`. That has now been removed; Issues for thrown errors
now have no comments at all when passed to the issue matcher. This
matches Issues for thrown errors that occur outside of
`withKnownIssue()` calls.

### 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.

---------

Co-authored-by: Jonathan Grynspan <grynspan@me.com>
Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
This introduces a new trait type named `IssueHandlingTrait` as SPI. It
allows observing, transforming, or filtering the issue(s) recorded
during the test it's applied to. Here's a contrived example:

```swift
@test(.transformIssues { issue in
  var issue = issue
  issue.comments.append("A comparison of two literals")
  return issue  // Or, return `nil` to suppress the issue
})
func example() {
  #expect(1 == 2)
}
```

### Motivation:

Sometimes it can be useful to customize an issue recorded during a test.
For example, you might wish to add supplemental information to it, such
by adding comments. Another example of this could be adding an
attachment to an issue, which was a capability mentioned as a [future
direction](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0009-attachments.md#future-directions)
in [ST-0009
Attachments](https://github.com/swiftlang/swift-evolution/blob/main/proposals/testing/0009-attachments.md).

Other times, you might wish to suppress an issue which is later
determined to be irrelevant or cannot be marked as a [known
issue](https://swiftpackageindex.com/swiftlang/swift-testing/main/documentation/testing/known-issues).
Or, you may simply want to be notified that an issue was recorded, to
react to it in some other way while still recording the issue normally.

### 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.

Resolves rdar://140144041
…#1097)

Remove experimental status for ConditionTrait.evaluate() and add
metadata

### Motivation:

Now that the proposal has been accepted, the experimental tag can be
removed.

### Modifications:

* Removed the `@_spi(Experimental)` attribute from
`ConditionTrait.evaluate()`
* Added metadata to the doc comment marking it as part of Swift 6.2

### 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.
This PR promotes exit tests to API, pending approval of the proposal at
swiftlang/swift-evolution#2718.

View the full proposal
[here](https://github.com/grynspan/swift-evolution/blob/jgrynspan/swift-testing-exit-tests/proposals/testing/NNNN-exit-tests.md).

### 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.

---------

Co-authored-by: Stuart Montgomery <smontgomery@apple.com>
This works around a macOS CI failure. A revert in the Swift compiler (in
swiftlang/swift#80830) is expected to resolve
it, but the release of a newer `main` development snapshot toolchain is
blocked for unrelated reasons.

### 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.
@stmontgomery stmontgomery added the integration ⚙️ Integrating work to release branches label May 1, 2025
@stmontgomery stmontgomery added this to the Swift 6.2 milestone May 1, 2025
@stmontgomery stmontgomery self-assigned this May 1, 2025
@stmontgomery
Copy link
Contributor Author

@swift-ci please test

@shahmishal shahmishal merged commit d3c1dca into swiftlang:release/6.2 May 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration ⚙️ Integrating work to release branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants