Skip to content

Commit fbcf039

Browse files
authored
Do pass explicit empty argument to -XCTest (#3631)
Right now if no tests are matching after filter/skip/etc, we pass no argument to `XCTest` which actually crashes the `xctest` CLI. This makes it so we instead pass an explicit empty argument to it.
1 parent 723679a commit fbcf039

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/Commands/SwiftTestTool.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,10 @@ public struct SwiftTestTool: SwiftCommand {
284284
// If there were no matches, emit a warning.
285285
if tests.isEmpty {
286286
swiftTool.diagnostics.emit(.noMatchingTests)
287+
xctestArg = "''"
288+
} else {
289+
xctestArg = tests.map { $0.specifier }.joined(separator: ",")
287290
}
288-
289-
xctestArg = tests.map { $0.specifier }.joined(separator: ",")
290291
}
291292

292293
let runner = TestRunner(

0 commit comments

Comments
 (0)