Skip to content

[chore]: improve Swift Testing support in test utilities #341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 15, 2025

Conversation

jamieQ
Copy link
Contributor

@jamieQ jamieQ commented May 8, 2025

migrates test utilities from XCTest assertions to analogs provided by the CustomDump and IssueReporting libraries. this should fix the issue where assertion failures would be invisible to client code written using Swift Testing rather than XCTest.

ideally we should probably add a lint check in the relevant places to enforce use of the appropriate API, but that will be a separate task.

resolves: #330

@jamieQ jamieQ force-pushed the jquadri/swift-testing-improvements branch from d950991 to 8ed5356 Compare May 8, 2025 21:32
@jamieQ jamieQ changed the title [chore]: improt Swift Testing support in test utilities [chore]: improve Swift Testing support in test utilities May 8, 2025
@jamieQ jamieQ force-pushed the jquadri/swift-testing-improvements branch from 196fa87 to d27e738 Compare May 13, 2025 20:01
@jamieQ jamieQ marked this pull request as ready for review May 13, 2025 20:04
@jamieQ jamieQ requested a review from a team as a code owner May 13, 2025 20:04
@@ -15,6 +15,7 @@
*/

#if DEBUG
import IssueReporting
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my education: where is this lib coming from? Apple side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a pointfree library – it's a dependency of the CustomDump lib that we already use: https://github.com/pointfreeco/swift-issue-reporting

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

though now that you bring it up... i wonder if it should be listed as an explicit dependency in the package?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -65,6 +65,7 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.4.0"),
.package(url: "https://github.com/pointfreeco/swift-perception", from: "1.5.0"),
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.2.1"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we currently already depend on this transitively through 'swift-custom-dump'. added as an explicit dependency because we're directly importing it in some spots now, and i assume that's the 'right thing to do'.

Copy link
Member

@gyfelton gyfelton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, better to have another one more familiar with this repo to review though

@@ -62,9 +63,9 @@ extension RenderTester {
guard !workflow.worker.isEquivalent(to: expectedWorker) else {
return
}
XCTFail(
reportIssue(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no Apple-provided way to do this?

Copy link
Contributor Author

@jamieQ jamieQ May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by 'this', what do you mean? record an issue in either testing framework? if so, i don't think so, at least not that i could easily find.

@jamieQ jamieQ merged commit 9572b8a into main May 15, 2025
8 checks passed
@jamieQ jamieQ deleted the jquadri/swift-testing-improvements branch May 15, 2025 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Swift Testing in test facilities
4 participants