cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
534 stars 65 forks source link

Add Bazel build support for swift-snapshot-testing #191

Closed luispadron closed 4 months ago

luispadron commented 5 months ago

Refactors the Bazel support to better match the Package.swift structure:

NickEntin commented 5 months ago

The module AccessibilitySnapshot uses swift-snapshot-testing and the FBSnapshotTestCase_Accessibility* modules use iOSSnapshotTestCase.

I think I'd rather be explicit about this (AccessibilitySnapshot_iOSSnapshotTestCase and AccessibilitySnapshot_SnapshotTesting) than assume the primary framework uses SnapshotTesting. The only reason the Package.swift defaults that way is iOSSnapshotTestCase didn't have SPM support when it was written. But seeing how things are going, I don't want to assume we'll stick with any particular snapshot engine for the long term. Eventually we may pull the snapshot comparison logic internally and only provide the SnapshotTesting integration as a convenience to use their method names.

luispadron commented 5 months ago

Ah that's fair, I was copying the Package setup but we can make this explicit on the impl used.

luispadron commented 5 months ago

@NickEntin I updated this to move the BUILD.bazel into the individual directories so its more explicit.

Bazel users can depend on either //Sources/Accessibility/SnapshotTesting/... targets or //Sources/Accessibility/iOSSnapshotTestCase/... targets. They would import it using the same module name import AccessibilitySnapshot (let me know if we instead prefer this import name to also be explicit, I assumed users wouldn't use both implementations in the same target)

Also updated the README with Bazel instructions