Skip to content

Commit b962977

Browse files
BridgeJS: Skip writing .actual files when updating snapshots
1 parent 02b5c26 commit b962977

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Plugins/BridgeJS/Tests/BridgeJSToolTests/SnapshotTesting.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ func assertSnapshot(
2424
let existingSnapshot = try String(contentsOf: snapshotPath, encoding: .utf8)
2525
let ok = existingSnapshot == String(data: input, encoding: .utf8)!
2626
let actualFilePath = snapshotPath.path + ".actual"
27+
let updateSnapshots = ProcessInfo.processInfo.environment["UPDATE_SNAPSHOTS"] != nil
2728
func buildComment() -> Comment {
2829
"Snapshot mismatch: \(actualFilePath) \(snapshotPath.path)"
2930
}
30-
if !ok {
31-
try input.write(to: URL(fileURLWithPath: actualFilePath))
32-
}
33-
if ProcessInfo.processInfo.environment["UPDATE_SNAPSHOTS"] == nil {
31+
if !updateSnapshots {
3432
#expect(ok, buildComment(), sourceLocation: sourceLocation)
33+
if !ok {
34+
try input.write(to: URL(fileURLWithPath: actualFilePath))
35+
}
3536
} else {
3637
try input.write(to: snapshotPath)
3738
}

0 commit comments

Comments
 (0)