Skip to content
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

Fix assertSnapshot for Swift Testing tests. #916

Merged
merged 3 commits into from
Oct 8, 2024
Merged

Conversation

mbrandonw
Copy link
Member

Fixes #915

Comment on lines -4 to -6
@_implementationOnly import Testing
import Testing

@_spi(Experimental)
Copy link
Member Author

Choose a reason for hiding this comment

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

Heads up @JRR-OSU and @kondratk. This will affect you based on our discussions in #901.

We have had to remove the @_implementationOnly imports for Testing because we want to remove the @_spi restriction from these testing traits. This means that once again Snapshot Testing will not work from UI testing targets. Again, we feel this is a bug for Apple to deal with, as Testing does not work in UI test targets.

The only other fix that comes to mind for this would be to move everything but the code that uses Swift Testing into some kind of "SnapshotTestingCore" module, and then that could be imported into UI test targets when needed. We will discuss this more.

@mbrandonw mbrandonw merged commit fb739f2 into main Oct 8, 2024
4 checks passed
@mbrandonw mbrandonw deleted the fix-swift-testing branch October 8, 2024 17:05
@IlyaPuchkaTW
Copy link

IlyaPuchkaTW commented Oct 17, 2024

Does this mean that attachments won't be available at all when running from Swift Testing? Seems like Swift Testing does not support it yet at all?

@stephencelis
Copy link
Member

@IlyaPuchkaTW That's correct. You can follow their progress here: swiftlang/swift-testing#714

JustasL added a commit to vinted/swift-snapshot-testing that referenced this pull request Dec 11, 2024
* main: (27 commits)
  Run swift-format
  Fix assertSnapshot for Swift Testing tests. (pointfreeco#916)
  Add an NB to @_implementationOnly import.
  Run swift-format
  Import only the implementation of Testing. (pointfreeco#903)
  fix missing inline snapshot testing (pointfreeco#887)
  Feature/fixed decimal separator (pointfreeco#889)
  Run swift-format
  Xcode 16 beta 5: Fix snapshots test trait (pointfreeco#885)
  Run swift-format
  Don't invoke XCTContext when running in the Testing framework. (pointfreeco#884)
  Run swift-format
  Fixed .failed record mode in inline snapshots. (pointfreeco#874)
  Point updated packages to swiftlang organization (pointfreeco#873)
  Fix recordIssue for Xcode beta 3. (pointfreeco#869)
  Run swift-format
  Beta support for Swift Testing, and other improvements. (pointfreeco#867)
  Run swift-format
  New `canGenerateNewSnapshots` to avoid automatically creating missing ones in CI (pointfreeco#768)
  Run swift-format
  ...
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.

Crash Current context must not be nil with swift-testing
3 participants