pointfreeco/swift-snapshot-testing
56.7
Adequate · 30 September 2026
7.7k
lines of production code
Swift
primary language
2
measurements over time
What this system is
This system is a Swift library for snapshot testing that captures and verifies the state of various values, including UI elements, paths, and encodable data structures. It supports both XCTest and the native Swift Testing framework, offering flexible recording modes and inline assertions to keep test code concise. The library provides strategies for generating visual images, JSON, property lists, and custom dump representations to ensure consistent output across different platforms and device configurations.
How it got here
2017 — Rebranding and Swift 6 modernization
6 changes.
The project was rebranded from swift-screenshot-assertions to SnapshotTesting, shifting focus from visual regression to broader value snapshotting. This period involved modernizing infrastructure by migrating to GitHub Actions, upgrading to Swift 6.0, and removing legacy screenshot-specific modules while adding support for the Swift Testing framework.
2018–2019 — Swift Testing integration and platform expansion
4 changes.
The SnapshotTesting library was rewritten to support Swift's native Testing library alongside XCTest, introducing structured configuration and async capabilities. New snapshotting strategies were added for various UI elements, encodable types, and paths, while device support was expanded to include newer iPhone models and cross-platform compatibility for Linux, Android, and Windows.
2023–2025 — Swift Testing and inline snapshot support
4 changes.
This period focused on modernizing the testing framework by adding native support for the Swift Testing environment and introducing an inline snapshot module. Key developments included deprecating legacy recording APIs, implementing a custom dump strategy for better value representation, and expanding test coverage to ensure compatibility with the new Swift Testing infrastructure.
Features
Add .customDump snapshot strategy
The SnapshotTestingCustomDump module now provides a \.customDump\ static property for String-based snapshotting, allowing users to compare structures using the custom dump format. This new strategy leverages the CustomDump library to generate human-readable representations of values, offering an alternative to previous dumping methods.
Sources/SnapshotTestingCustomDump · high confidence
Add wait strategy extension for snapshotting
Users can now use the new \Snapshotting.wait\ extension to delay snapshot capture by a specified duration, which is useful for waiting for animations or UI events to complete before taking a snapshot.
Sources/SnapshotTesting/Extensions · high confidence
Introduce InlineSnapshotTesting module for in-file snapshot assertions
Adds the new InlineSnapshotTesting library, which allows snapshot values to be written directly into the test source file as trailing closures rather than external files. The module provides the \assertInlineSnapshot\ function, which automatically records new snapshots on the first run (or when configured via the \record\ parameter) and compares subsequent runs against the inlined expected value, simplifying verification by keeping the assertion and its reference data together.
Sources/InlineSnapshotTesting · high confidence
New snapshotting strategies for paths, encodable types, and views
This release adds dedicated snapshotting strategies for several new types, allowing you to assert on their visual or textual representations. You can now snapshot \CGPath\, \UIBezierPath\, and \NSBezierPath\ objects using \.image\ (with configurable precision and perceptual precision) or \.elementsDescription\ for textual element comparison. Encodable types (\Encodable\) can be snapshot as JSON (\.json\) or Property Lists (\.plist\). Additionally, new strategies are available for \CALayer\ (\.image\), \NSView\ (\.image\ and \.recursiveDescription\), \NSViewController\ (\.image\ and \.recursiveDescription\), \SceneKit\ scenes (\.image\), and \SpriteKit\ scenes (\.image\). The \SwiftUIView\ strategy now supports layout overrides via \SwiftUISnapshotLayout\ (\.device\, \.fixed\, \.sizeThatFits\) and trait collection customization.
Sources/SnapshotTesting/Snapshotting · high confidence
Removals
Removal of ScreenshotAssertions module
The ScreenshotAssertions module has been removed from the codebase. This eliminates the \assertScreenshot\ function that previously allowed developers to capture UIView renderings and compare them against stored baseline images for visual regression testing.
Sources/ScreenshotAssertions · high confidence
Behavioural changes
Deprecate legacy record API and add Swift Testing support
The \record\ parameter in snapshot assertion functions is deprecated in favor of the new \SnapshotTestingConfiguration.Record\ enum, guiding users toward a more explicit recording mode. Additionally, the internal issue recording mechanism now detects when tests are running under the Swift Testing framework and uses \Issue.record\ instead of \XCTFail\, ensuring compatibility with Swift Testing.
Sources/SnapshotTesting/Internal · high confidence
Expanded device support and platform compatibility for snapshot testing
Snapshot testing now supports iPhone 12, iPhone 12 Pro Max, and iPhone 13 devices, along with updated safe area and size configurations for existing models. The library adds compatibility for Linux, Android, and Windows platforms through new shims and internal utilities, including a custom PlistEncoder for older Swift versions and platform-specific type aliases. Additionally, the ViewImageConfig struct is now Sendable, and new helper methods allow for detecting escaped special characters in string literals to improve inline snapshot accuracy.
Sources/SnapshotTesting/Common · high confidence
Project rebranding to SnapshotTesting and infrastructure modernization
The project has been renamed from 'swift-screenshot-assertions' to 'swift-snapshot-testing', updating the package name, README, and CI badges to reflect the broader capability of snapshotting any value, not just screenshots. The repository infrastructure has been modernized by migrating from CircleCI to GitHub Actions, adding a Makefile for standardized local testing across Linux, macOS, iOS, and tvOS, and introducing an .editorconfig for consistent code formatting. Additionally, the package now includes a dedicated 'InlineSnapshotTesting' product and a 'SnapshotTestingCustomDump' dependency on 'swift-custom-dump', while the minimum supported platform versions have been explicitly set to iOS 13, macOS 10.15, tvOS 13, and watchOS 6.
(repo-wide) · high confidence
SnapshotTesting library rewritten with Swift Testing support and structured configuration
The SnapshotTesting library has been completely rewritten to support Swift's native Testing library alongside XCTest. Users can now configure snapshot recording modes (all, missing, failed, never) and diff tools using a dedicated \withSnapshotTesting\ scope for XCTest or a \snapshots\ trait for Swift Testing. The API introduces \assertSnapshot\ and \assertSnapshots\ functions that accept a \record\ parameter, deprecating the global \isRecording\ variable. The library also introduces an \Async\ wrapper for asynchronous snapshot strategies, a new \Diffing\ protocol with \diffV2\ for improved attachment handling, and a \Snapshotting\ strategy with \pullback\ and \asyncPullback\ methods for composing snapshot types.
Sources/SnapshotTesting · high confidence
Test coverage
Added snapshot test baselines for Swift Testing support; Added test coverage for Swift Testing integration and snapshot recording modes; Added test suite for Swift Testing integration and custom dump strategies; Removal of legacy ScreenshotAssertionsTests.swift test file.
Dependencies
Upgrade to Swift 6.0 and update dependencies
The package now requires Swift 6.0 and targets iOS 13, macOS 10.15, tvOS 13, and watchOS 6. It has been renamed to 'swift-snapshot-testing' and now depends on swift-syntax (versions 509.0.0 to 605.0.0) and swift-custom-dump (1.3.3). The package structure has been updated to include new targets for InlineSnapshotTesting and SnapshotTestingCustomDump, reflecting changes in dependency management and platform support.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 58 → 57 (-0.8)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 93 → 90 (-3.1)
- Architecture 98 → 95 (-3.7)
- Maturity 53 → 53 (+0.0)
- Readiness 55 → 59 (+4.2)
- Security 49 → 49 (+0.0)
Resolved (4)
- Documentation: no architecture or design documentation (README.md)
- Documentation: no installation or build instructions (README.md)
- Documentation: no licence statement (README.md)
- Off-boarding risk: anonymized user #1
New (41)
- Any.swift.snap (cognitive 16) (Sources/SnapshotTesting/Snapshotting/Any.swift)
- Any.swift.snap (cyclomatic 21) (Sources/SnapshotTesting/Snapshotting/Any.swift)
- AssertInlineSnapshot.swift.assertInlineSnapshot (cognitive 28) (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
- AssertInlineSnapshot.swift.assertInlineSnapshot (cyclomatic 17) (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
- AssertSnapshot.swift.verifySnapshot (cognitive 74) (Sources/SnapshotTesting/AssertSnapshot.swift)
- AssertSnapshot.swift.verifySnapshot (cyclomatic 36) (Sources/SnapshotTesting/AssertSnapshot.swift)
- Deprecations.swift._verifyInlineSnapshot (cognitive 23) (Sources/SnapshotTesting/Internal/Deprecations.swift)
- Duplicated block (10–11 lines × 2) (Sources/SnapshotTesting/Internal/Deprecations.swift)
- Duplicated block (10–12 lines × 9) (Sources/SnapshotTesting/Common/View.swift)
- Duplicated block (16 lines × 2) (Sources/SnapshotTesting/Internal/Deprecations.swift)
- Duplicated block (20 lines × 2) (Sources/SnapshotTesting/Internal/Deprecations.swift)
- Duplicated block (20 lines × 2) (Sources/SnapshotTesting/Snapshotting/NSImage.swift)
- Duplicated block (21 lines × 5) (Sources/SnapshotTesting/Common/View.swift)
- Duplicated block (22 lines × 2) (Sources/SnapshotTesting/AssertSnapshot.swift)
- Duplicated block (22 lines × 5) (Sources/SnapshotTesting/Common/View.swift)
- Duplicated block (8 lines × 2) (Sources/SnapshotTesting/AssertSnapshot.swift)
- Duplicated block (8 lines × 2) (Sources/SnapshotTesting/Snapshotting/NSImage.swift)
- Duplicated block (9 lines × 2) (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
- FunctionTooLong: AssertInlineSnapshot.swift.assertInlineSnapshot (Sources/InlineSnapshotTesting/AssertInlineSnapshot.swift)
- FunctionTooLong: AssertSnapshot.swift.verifySnapshot (Sources/SnapshotTesting/AssertSnapshot.swift)
- …and 21 more
Changes since last survey
- 2 commits — 0 feature/other, 2 fixes
By area
- Sources/SnapshotTesting — 2 commits
Notable commits
- fix: Fix perceptual image comparison on macOS 27 (#1120)
- fix: Fix watchOS compile error: 'Image' not in scope (#1101)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
pointfreeco/swift-snapshot-testing was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 28e5de025e3fd98991791bfbf83023ab3708da03 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.