Skip to content

Commit b79bd86

Browse files
fix: remove trailing commas in Swift for Xcode <16.3 compatibility (#186)
* fix: remove trailing commas in Swift for Xcode <16.3 compatibility Remove trailing commas from function/initializer argument lists in the iOS XCUITest runner Swift source files. SE-0439 trailing commas in comma-separated lists require Swift 6.1+ (Xcode 16.3+), but the runner is compiled locally by users who may have older Xcode versions. Users with Xcode 16.2 (Swift 6.0.3) encounter build failures: error: unexpected ',' separator This causes the runner to never start, surfacing as: Error (COMMAND_FAILED): Runner did not accept connection (simctl spawn) Files fixed (12 trailing commas removed): - RunnerTests+Snapshot.swift (5) - RunnerTests+Transport.swift (2) - RunnerTests+CommandExecution.swift (1) - RunnerTests+ScreenRecorder.swift (2) - RunnerTests.swift (2) Verified: pnpm build:xcuitest passes (TEST BUILD SUCCEEDED). * ci: guard iOS runner trailing-comma syntax --------- Co-authored-by: Michał Pierzchała <[email protected]>
1 parent 3bafc24 commit b79bd86

6 files changed

Lines changed: 27 additions & 12 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
ios-runner-swift-compat:
18+
name: iOS Runner Swift Compatibility
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
24+
25+
- name: Disallow trailing commas before closing parenthesis in Swift
26+
run: |
27+
if rg -nU --glob '*.swift' ',\s*\n\s*\)' ios-runner; then
28+
echo "Found trailing commas before ')' in Swift files. This syntax requires Swift 6.1+ and breaks older Xcode toolchains."
29+
exit 1
30+
fi
31+
1732
unit:
1833
name: Unit Tests
1934
runs-on: ubuntu-latest

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+CommandExecution.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ extension RunnerTests {
310310
compact: command.compact ?? false,
311311
depth: command.depth,
312312
scope: command.scope,
313-
raw: command.raw ?? false,
313+
raw: command.raw ?? false
314314
)
315315
if options.raw {
316316
needsPostSnapshotInteractionDelay = true

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+ScreenRecorder.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ extension RunnerTests {
6868
let outputSettings: [String: Any] = [
6969
AVVideoCodecKey: AVVideoCodecType.h264,
7070
AVVideoWidthKey: Int(dimensions.width),
71-
AVVideoHeightKey: Int(dimensions.height),
71+
AVVideoHeightKey: Int(dimensions.height)
7272
]
7373
let input = AVAssetWriterInput(mediaType: .video, outputSettings: outputSettings)
7474
input.expectsMediaDataInRealTime = true
7575
let attributes: [String: Any] = [
7676
kCVPixelBufferPixelFormatTypeKey as String: kCVPixelFormatType_32ARGB,
7777
kCVPixelBufferWidthKey as String: Int(dimensions.width),
78-
kCVPixelBufferHeightKey as String: Int(dimensions.height),
78+
kCVPixelBufferHeightKey as String: Int(dimensions.height)
7979
]
8080
let adaptor = AVAssetWriterInputPixelBufferAdaptor(
8181
assetWriterInput: input,

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Snapshot.swift‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ extension RunnerTests {
8282
x: Double(rootSnapshot.frame.origin.x),
8383
y: Double(rootSnapshot.frame.origin.y),
8484
width: Double(rootSnapshot.frame.size.width),
85-
height: Double(rootSnapshot.frame.size.height),
85+
height: Double(rootSnapshot.frame.size.height)
8686
),
8787
enabled: rootSnapshot.isEnabled,
8888
hittable: rootHittable,
89-
depth: 0,
89+
depth: 0
9090
)
9191
)
9292

@@ -149,11 +149,11 @@ extension RunnerTests {
149149
x: Double(snapshot.frame.origin.x),
150150
y: Double(snapshot.frame.origin.y),
151151
width: Double(snapshot.frame.size.width),
152-
height: Double(snapshot.frame.size.height),
152+
height: Double(snapshot.frame.size.height)
153153
),
154154
enabled: snapshot.isEnabled,
155155
hittable: hittable,
156-
depth: min(maxDepth, visibleDepth),
156+
depth: min(maxDepth, visibleDepth)
157157
)
158158
)
159159

@@ -216,7 +216,7 @@ extension RunnerTests {
216216
rect: snapshotRect(from: snapshot.frame),
217217
enabled: snapshot.isEnabled,
218218
hittable: hittable,
219-
depth: depth,
219+
depth: depth
220220
)
221221
)
222222
}

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests+Transport.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ extension RunnerTests {
1919
if buffer.count + data.count > self.maxRequestBytes {
2020
let response = self.jsonResponse(
2121
status: 413,
22-
response: Response(ok: false, error: ErrorPayload(message: "request too large")),
22+
response: Response(ok: false, error: ErrorPayload(message: "request too large"))
2323
)
2424
connection.send(content: response, completion: .contentProcessed { [weak self] _ in
2525
connection.cancel()
@@ -111,7 +111,7 @@ extension RunnerTests {
111111
"Content-Length: \(body.utf8.count)",
112112
"Connection: close",
113113
"",
114-
body,
114+
body
115115
].joined(separator: "\r\n")
116116
return Data(headers.utf8)
117117
}

‎ios-runner/AgentDeviceRunner/AgentDeviceRunnerUITests/RunnerTests.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ final class RunnerTests: XCTestCase {
5959
.tabBar,
6060
.textField,
6161
.secureTextField,
62-
.textView,
62+
.textView
6363
]
6464
// Keep blocker actions narrow to avoid false positives from generic hittable containers.
6565
let actionableTypes: Set<XCUIElement.ElementType> = [
@@ -68,7 +68,7 @@ final class RunnerTests: XCTestCase {
6868
.link,
6969
.menuItem,
7070
.checkBox,
71-
.switch,
71+
.switch
7272
]
7373

7474
// MARK: - XCTest Entry

0 commit comments

Comments
 (0)