@@ -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