@@ -256,7 +256,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
256
256
var results = [ TestRunner . Result] ( )
257
257
258
258
// Run XCTest.
259
- if options. testLibraryOptions. isEnabled ( . xctest) {
259
+ if options. testLibraryOptions. isEnabled ( . xctest, swiftCommandState : swiftCommandState ) {
260
260
// validate XCTest available on darwin based systems
261
261
let toolchain = try swiftCommandState. getTargetToolchain ( )
262
262
if case let . unsupported( reason) = try swiftCommandState. getHostToolchain ( ) . swiftSDK. xctestSupport {
@@ -324,9 +324,9 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
324
324
}
325
325
326
326
// Run Swift Testing (parallel or not, it has a single entry point.)
327
- if options. testLibraryOptions. isEnabled ( . swiftTesting) {
327
+ if options. testLibraryOptions. isEnabled ( . swiftTesting, swiftCommandState : swiftCommandState ) {
328
328
lazy var testEntryPointPath = testProducts. lazy. compactMap ( \. testEntryPointPath) . first
329
- if options. testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) || testEntryPointPath == nil {
329
+ if options. testLibraryOptions. isExplicitlyEnabled ( . swiftTesting, swiftCommandState : swiftCommandState ) || testEntryPointPath == nil {
330
330
results. append (
331
331
try await runTestProducts (
332
332
testProducts,
@@ -412,7 +412,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
412
412
public func run( _ swiftCommandState: SwiftCommandState ) async throws {
413
413
do {
414
414
// Validate commands arguments
415
- try self . validateArguments ( observabilityScope : swiftCommandState. observabilityScope )
415
+ try self . validateArguments ( swiftCommandState : swiftCommandState)
416
416
} catch {
417
417
swiftCommandState. observabilityScope. emit ( error)
418
418
throw ExitCode . failure
@@ -466,7 +466,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
466
466
}
467
467
additionalArguments += commandLineArguments
468
468
469
- if var xunitPath = options. xUnitOutput, options. testLibraryOptions. isEnabled ( . xctest) {
469
+ if var xunitPath = options. xUnitOutput, options. testLibraryOptions. isEnabled ( . xctest, swiftCommandState : swiftCommandState ) {
470
470
// We are running Swift Testing, XCTest is also running in this session, and an xUnit path
471
471
// was specified. Make sure we don't stomp on XCTest's XML output by having Swift Testing
472
472
// write to a different path.
@@ -634,7 +634,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
634
634
/// Private function that validates the commands arguments
635
635
///
636
636
/// - Throws: if a command argument is invalid
637
- private func validateArguments( observabilityScope : ObservabilityScope ) throws {
637
+ private func validateArguments( swiftCommandState : SwiftCommandState ) throws {
638
638
// Validation for --num-workers.
639
639
if let workers = options. numberOfWorkers {
640
640
@@ -649,13 +649,13 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
649
649
throw StringError ( " '--num-workers' must be greater than zero " )
650
650
}
651
651
652
- guard options. testLibraryOptions. isEnabled ( . xctest) else {
652
+ guard options. testLibraryOptions. isEnabled ( . xctest, swiftCommandState : swiftCommandState ) else {
653
653
throw StringError ( " '--num-workers' is only supported when testing with XCTest " )
654
654
}
655
655
}
656
656
657
657
if options. _deprecated_shouldListTests {
658
- observabilityScope. emit ( warning: " '--list-tests' option is deprecated; use 'swift test list' instead " )
658
+ swiftCommandState . observabilityScope. emit ( warning: " '--list-tests' option is deprecated; use 'swift test list' instead " )
659
659
}
660
660
}
661
661
@@ -739,7 +739,7 @@ extension SwiftTestCommand {
739
739
library: . swiftTesting
740
740
)
741
741
742
- if testLibraryOptions. isEnabled ( . xctest) {
742
+ if testLibraryOptions. isEnabled ( . xctest, swiftCommandState : swiftCommandState ) {
743
743
let testSuites = try TestingSupport . getTestSuites (
744
744
in: testProducts,
745
745
swiftCommandState: swiftCommandState,
@@ -755,9 +755,9 @@ extension SwiftTestCommand {
755
755
}
756
756
}
757
757
758
- if testLibraryOptions. isEnabled ( . swiftTesting) {
758
+ if testLibraryOptions. isEnabled ( . swiftTesting, swiftCommandState : swiftCommandState ) {
759
759
lazy var testEntryPointPath = testProducts. lazy. compactMap ( \. testEntryPointPath) . first
760
- if testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) || testEntryPointPath == nil {
760
+ if testLibraryOptions. isExplicitlyEnabled ( . swiftTesting, swiftCommandState : swiftCommandState ) || testEntryPointPath == nil {
761
761
let additionalArguments = [ " --list-tests " ] + CommandLine. arguments. dropFirst ( )
762
762
let runner = TestRunner (
763
763
bundlePaths: testProducts. map ( \. binaryPath) ,
0 commit comments