Skip to content

Commit 8246b8b

Browse files
committed
Revert now unnecessary swift testing argument handling
1 parent d056ae8 commit 8246b8b

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

Sources/Commands/SwiftTestCommand.swift

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -671,17 +671,20 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
671671
swiftCommandState: SwiftCommandState,
672672
library: TestingLibrary
673673
) async throws -> TestRunner.Result {
674-
// Pass through arguments that come after "--" to Swift Testing.
674+
// Pass through all arguments from the command line to Swift Testing.
675675
var additionalArguments = additionalArguments
676676
if library == .swiftTesting {
677-
// Only pass arguments that come after the "--" separator to Swift Testing
678-
let allCommandLineArguments = CommandLine.arguments.dropFirst()
679-
680-
if let separatorIndex = allCommandLineArguments.firstIndex(of: "--") {
681-
// Only pass arguments after the "--" separator
682-
let testArguments = Array(allCommandLineArguments.dropFirst(separatorIndex + 1))
683-
additionalArguments += testArguments
677+
// Reconstruct the arguments list. If an xUnit path was specified, remove it.
678+
var commandLineArguments = [String]()
679+
var originalCommandLineArguments = CommandLine.arguments.dropFirst().makeIterator()
680+
while let arg = originalCommandLineArguments.next() {
681+
if arg == "--xunit-output" {
682+
_ = originalCommandLineArguments.next()
683+
} else {
684+
commandLineArguments.append(arg)
685+
}
684686
}
687+
additionalArguments += commandLineArguments
685688

686689
if var xunitPath = options.xUnitOutput {
687690
if options.testLibraryOptions.isEnabled(.xctest, swiftCommandState: swiftCommandState) {

0 commit comments

Comments
 (0)