Skip to content

Commit

Permalink
Merge branch 'main' into orm
Browse files Browse the repository at this point in the history
# Conflicts:
#	Sources/SnapshotTesting/AssertSnapshot.swift
  • Loading branch information
awaltzforvenus committed Jul 31, 2024
2 parents 022ba98 + 2d0d95e commit 7e472fa
Show file tree
Hide file tree
Showing 42 changed files with 1,848 additions and 433 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 3 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
"version" : "510.0.2"
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/apple/swift-syntax", "508.0.1"..<"601.0.0")
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"601.0.0-prerelease")
],
targets: [
.target(
Expand Down
32 changes: 22 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,28 @@ Repeat test runs will load this reference and compare it with the runtime value.
match, the test will fail and describe the difference. Failures can be inspected from Xcode's Report
Navigator or by inspecting the file URLs of the failure.

You can record a new reference by setting the `record` parameter to `true` on the assertion or
setting `isRecording` globally.
You can record a new reference by customizing snapshots inline with the assertion, or using the
`withSnapshotTesting` tool:

``` swift
assertSnapshot(of: vc, as: .image, record: true)

// or globally
```swift
// Record just this one snapshot
assertSnapshot(of: vc, as: .image, record: .all)

// Record all snapshots in a scope:
withSnapshotTesting(record: .all) {
assertSnapshot(of: vc1, as: .image)
assertSnapshot(of: vc2, as: .image)
assertSnapshot(of: vc3, as: .image)
}

isRecording = true
assertSnapshot(of: vc, as: .image)
// Record all snapshots in an XCTestCase subclass:
class FeatureTests: XCTestCase {
override func invokeTest() {
withSnapshotTesting(record: .all) {
super.invokeTest()
}
}
}
```

## Snapshot Anything
Expand Down Expand Up @@ -218,9 +230,9 @@ targets: [
- **`Codable` support**. Snapshot encodable data structures into their JSON and property list
representations.
- **Custom diff tool integration**. Configure failure messages to print diff commands for
[Kaleidoscope](https://kaleidoscope.app) (or your diff tool of choice).
[Kaleidoscope](https://kaleidoscope.app) or your diff tool of choice.
``` swift
SnapshotTesting.diffTool = "ksdiff"
SnapshotTesting.diffToolCommand = { "ksdiff \($0) \($1)" }
```

[available-strategies]: https://swiftpackageindex.com/pointfreeco/swift-snapshot-testing/main/documentation/snapshottesting/snapshotting
Expand Down
Loading

0 comments on commit 7e472fa

Please sign in to comment.