Skip to content

Conversation

@stephencelis
Copy link
Member

When Snapshot Testing added Swift Testing support, it unfortunately broke the ability to use the library in UI test targets, which are incompatible with Swift Testing, and Apple does not appear provide the tools to statically bracket code in UI test targets.

To alleviate the issue, this PR divides Snapshot Testing functionality between a few modules so that a new UISnapshotTesting target can be introduced and depended on instead.

Swift Testing is not compatible with UITest targets at the moment, but
unfortunately `#if canImport` still returns `true`, making it difficult
to ship libraries that provide tools for both `Testing` and `XCTest`,
like the `assertSnapshot`. The previous workarounds we relied on have
stopped working, and so we need a new approach.

In this PR we have introduced a forwards-compatible `SnapshotUITesting`
module that does not rely on any imports of `Testing` internally. We can
then introduce Swift Testing support in the `SnapshotTesting` module,
instead.
@mbrandonw mbrandonw closed this May 16, 2025
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.

3 participants