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