@@ -325,14 +325,7 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
325
325
326
326
// Run Swift Testing (parallel or not, it has a single entry point.)
327
327
if options. testLibraryOptions. isEnabled ( . swiftTesting) {
328
- if let testEntryPointPath = testProducts. lazy. compactMap ( \. testEntryPointPath) . first,
329
- options. testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) == nil {
330
- // Cannot run Swift Testing because an entry point file was used, and the developer
331
- // didn't explicitly enable Swift Testing.
332
- swiftCommandState. observabilityScope. emit (
333
- debug: " Skipping automatic Swift Testing invocation because a test entry point path is present: \( testEntryPointPath) "
334
- )
335
- } else {
328
+ if options. testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) || testEntryPointPath == nil {
336
329
results. append (
337
330
try await runTestProducts (
338
331
testProducts,
@@ -342,6 +335,12 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
342
335
library: . swiftTesting
343
336
)
344
337
)
338
+ } else if let testEntryPointPath {
339
+ // Cannot run Swift Testing because an entry point file was used and the developer
340
+ // didn't explicitly enable Swift Testing.
341
+ swiftCommandState. observabilityScope. emit (
342
+ debug: " Skipping automatic Swift Testing invocation because a test entry point path is present: \( testEntryPointPath) "
343
+ )
345
344
}
346
345
}
347
346
@@ -734,14 +733,8 @@ extension SwiftTestCommand {
734
733
}
735
734
736
735
if testLibraryOptions. isEnabled ( . swiftTesting) {
737
- if let testEntryPointPath = testProducts. lazy. compactMap ( \. testEntryPointPath) . first,
738
- testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) == nil {
739
- // Cannot run Swift Testing because an entry point file was used, and the developer
740
- // didn't explicitly enable Swift Testing.
741
- swiftCommandState. observabilityScope. emit (
742
- debug: " Skipping automatic Swift Testing invocation (list) because a test entry point path is present: \( testEntryPointPath) "
743
- )
744
- } else {
736
+ lazy var testEntryPointPath = testProducts. lazy. compactMap ( \. testEntryPointPath) . first
737
+ if testLibraryOptions. isExplicitlyEnabled ( . swiftTesting) || testEntryPointPath == nil {
745
738
let additionalArguments = [ " --list-tests " ] + CommandLine. arguments. dropFirst ( )
746
739
let runner = TestRunner (
747
740
bundlePaths: testProducts. map ( \. binaryPath) ,
@@ -762,6 +755,12 @@ extension SwiftTestCommand {
762
755
if result == . failure {
763
756
swiftCommandState. executionStatus = . failure
764
757
}
758
+ } else if let testEntryPointPath {
759
+ // Cannot run Swift Testing because an entry point file was used and the developer
760
+ // didn't explicitly enable Swift Testing.
761
+ swiftCommandState. observabilityScope. emit (
762
+ debug: " Skipping automatic Swift Testing invocation (list) because a test entry point path is present: \( testEntryPointPath) "
763
+ )
765
764
}
766
765
}
767
766
}
0 commit comments