@@ -678,17 +678,20 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
678678 swiftCommandState: SwiftCommandState ,
679679 library: TestingLibrary
680680 ) async throws -> TestRunner . Result {
681- // Pass through arguments that come after "--" to Swift Testing.
681+ // Pass through all arguments from the command line to Swift Testing.
682682 var additionalArguments = additionalArguments
683683 if library == . swiftTesting {
684- // Only pass arguments that come after the "--" separator to Swift Testing
685- let allCommandLineArguments = CommandLine . arguments. dropFirst ( )
686-
687- if let separatorIndex = allCommandLineArguments. firstIndex ( of: " -- " ) {
688- // Only pass arguments after the "--" separator
689- let testArguments = Array ( allCommandLineArguments. dropFirst ( separatorIndex + 1 ) )
690- additionalArguments += testArguments
684+ // Reconstruct the arguments list. If an xUnit path was specified, remove it.
685+ var commandLineArguments = [ String] ( )
686+ var originalCommandLineArguments = CommandLine . arguments. dropFirst ( ) . makeIterator ( )
687+ while let arg = originalCommandLineArguments. next ( ) {
688+ if arg == " --xunit-output " {
689+ _ = originalCommandLineArguments. next ( )
690+ } else {
691+ commandLineArguments. append ( arg)
692+ }
691693 }
694+ additionalArguments += commandLineArguments
692695
693696 if var xunitPath = options. xUnitOutput {
694697 if options. testLibraryOptions. isEnabled ( . xctest, swiftCommandState: swiftCommandState) {
0 commit comments