Skip to content

SnapshotTesting 2.0 #1003

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

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
12607b1
Project refactor
o-nnerb Jun 20, 2025
101486a
Fixed package.swift
o-nnerb Jun 20, 2025
591a223
Fixed broken link at Readme.md
o-nnerb Jun 20, 2025
3b5237f
Remove Swift 5.9 support
o-nnerb Jun 21, 2025
54f4cc1
Add Inconsistent Traits Checker
o-nnerb Jun 21, 2025
5b882fa
Deprecated tests
o-nnerb Jun 21, 2025
c673c6b
Disabled deprecated tests for visionOS
o-nnerb Jun 22, 2025
5cbbaa5
Run swift-format
o-nnerb Jun 22, 2025
7c0ee96
Refator WindowPool and run some tests at macOS
o-nnerb Jun 22, 2025
82c7f75
Updated documentation, applied Swift Format and fixed some code
o-nnerb Jun 28, 2025
70f1908
Added SnapshotAttachment to use Attachment for Swift Testing availabl…
o-nnerb Jun 28, 2025
25b32bb
Fix build and tests for Windows
o-nnerb Jun 28, 2025
3bd1b4f
Applied Swift Format
o-nnerb Jun 28, 2025
6f4da01
Updated some tests and fix some code
o-nnerb Jun 28, 2025
ebd1dbc
Updated documentation
o-nnerb Jun 29, 2025
0496e9b
Updated tests for SnapshotTestingTests
o-nnerb Jun 29, 2025
b557bf5
Applied Swift Format
o-nnerb Jun 29, 2025
8e3a292
Run and updated test in all platforms:
o-nnerb Jul 5, 2025
ab70025
Renamed XCTSnapshot to XCSnapshotTesting, preserving the original nam…
o-nnerb Jul 5, 2025
7398575
WIP: Updating documentation
o-nnerb Jul 5, 2025
2d2891c
Merge branch 'snapshot-2.0'
o-nnerb Jul 5, 2025
4185d9a
Added @seanwoodward code
o-nnerb Jul 5, 2025
6becaac
Applied swift format
o-nnerb Jul 5, 2025
96bf2e9
Improved IdentitySnapshot to eliminate the requirement of using Bytes…
o-nnerb Jul 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 3 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
62 changes: 62 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"version" : 1,
"indentation" : {
"spaces" : 4
},
"tabWidth" : 4,
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"spacesAroundRangeFormationOperators" : false,
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"respectsExistingLineBreaks" : true,
"prioritizeKeepingFunctionOutputTogether" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLiteralForEmptyCollectionInit" : false,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoAssignmentInExpressions" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : true,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OmitExplicitReturns" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : true,
"ReplaceForEachWithForLoop" : true,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : false,
"UseExplicitNilCheckInConditions" : false,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
}
}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ format:
--ignore-unparsable-files \
--in-place \
--recursive \
./Package.swift ./Sources ./Tests
Package.swift ./Tests $(find ./Sources -name "*.swift" \ -not -path "./Sources/Deprecated/*")

test-all: test-linux test-macos test-ios
7 changes: 4 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

194 changes: 130 additions & 64 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,69 +1,135 @@
// swift-tools-version:5.9
// swift-tools-version: 6.1

import PackageDescription

let package = Package(
name: "swift-snapshot-testing",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(
name: "SnapshotTesting",
targets: ["SnapshotTesting"]
),
.library(
name: "InlineSnapshotTesting",
targets: ["InlineSnapshotTesting"]
),
.library(
name: "SnapshotTestingCustomDump",
targets: ["SnapshotTestingCustomDump"]
),
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"602.0.0"),
],
targets: [
.target(
name: "SnapshotTesting"
),
.testTarget(
name: "SnapshotTestingTests",
dependencies: [
"SnapshotTesting"
],
exclude: [
"__Fixtures__",
"__Snapshots__",
]
),
.target(
name: "InlineSnapshotTesting",
dependencies: [
"SnapshotTesting",
"SnapshotTestingCustomDump",
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
]
),
.testTarget(
name: "InlineSnapshotTestingTests",
dependencies: [
"InlineSnapshotTesting"
]
),
.target(
name: "SnapshotTestingCustomDump",
dependencies: [
"SnapshotTesting",
.product(name: "CustomDump", package: "swift-custom-dump"),
]
),
]
name: "swift-snapshot-testing",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(
name: "XCSnapshotTesting",
targets: ["XCSnapshotTesting"]
),
.library(
name: "SnapshotTesting",
targets: ["SnapshotTesting"]
),
.library(
name: "SnapshotTestingCustomDump",
targets: ["SnapshotTestingCustomDump"]
),
.library(
name: "InlineSnapshotTesting",
targets: ["InlineSnapshotTesting"]
),
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.3.3"),
.package(url: "https://github.com/swiftlang/swift-syntax", "601.0.0"..<"602.0.0"),
],
targets: [
/* DEPRECATED TARGETS */
.target(
name: "_SnapshotTesting",
path: "Sources/Deprecated/SnapshotTesting",
swiftSettings: [.swiftLanguageMode(.v5)]
),
.target(
name: "_SnapshotTestingCustomDump",
dependencies: [
"_SnapshotTesting",
.product(name: "CustomDump", package: "swift-custom-dump"),
],
path: "Sources/Deprecated/SnapshotTestingCustomDump",
swiftSettings: [.swiftLanguageMode(.v5)]
),
.target(
name: "_InlineSnapshotTesting",
dependencies: [
"_SnapshotTesting",
"_SnapshotTestingCustomDump",
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
],
path: "Sources/Deprecated/InlineSnapshotTesting",
swiftSettings: [.swiftLanguageMode(.v5)]
),
/* TARGETS */
.target(
name: "XCSnapshotTesting",
dependencies: ["_SnapshotTesting"]
),
.target(
name: "SnapshotTesting",
dependencies: ["XCSnapshotTesting"]
),
.target(
name: "SnapshotTestingCustomDump",
dependencies: [
"XCSnapshotTesting",
.product(name: "CustomDump", package: "swift-custom-dump"),
"_SnapshotTestingCustomDump",
]
),
.target(
name: "InlineSnapshotTesting",
dependencies: [
"SnapshotTesting",
"SnapshotTestingCustomDump",
.product(name: "SwiftParser", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftSyntaxBuilder", package: "swift-syntax"),
"_InlineSnapshotTesting",
]
),
/* DEPRECATED TESTS */
.testTarget(
name: "_SnapshotTestingTests",
dependencies: ["XCSnapshotTesting", "SnapshotTesting"],
path: "Tests/Deprecated/SnapshotTestingTests",
exclude: [
"__Fixtures__",
"__Snapshots__",
],
swiftSettings: [.swiftLanguageMode(.v5)]
),
.testTarget(
name: "_InlineSnapshotTestingTests",
dependencies: ["InlineSnapshotTesting"],
path: "Tests/Deprecated/InlineSnapshotTestingTests",
swiftSettings: [.swiftLanguageMode(.v5)]
),
/* TESTS */
.testTarget(
name: "XCSnapshotTestingTests",
dependencies: ["XCSnapshotTesting"],
exclude: [
"__Fixtures__",
"__Snapshots__",
]
),
.testTarget(
name: "SnapshotTestingTests",
dependencies: ["SnapshotTesting"],
exclude: ["__Snapshots__"]
),
.testTarget(
name: "SnapshotTestingCustomDumpTests",
dependencies: [
"SnapshotTestingCustomDump"
]
),
.testTarget(
name: "InlineSnapshotTestingTests",
dependencies: [
"InlineSnapshotTesting"
]
),
]
)
70 changes: 0 additions & 70 deletions [email protected]

This file was deleted.

Loading