Skip to content

Commit c03482b

Browse files
committed
Revert now unnecessary swift testing argument handling
1 parent 0564f93 commit c03482b

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

Comments
 (0)