Skip to content

Commit bb43131

Browse files
committed
Clarify logic around the entry-point bailouts in swift test
1 parent b1a1ead commit bb43131

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/Commands/SwiftTestCommand.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,10 @@ public struct SwiftTestCommand: AsyncSwiftCommand {
325325

326326
// Run Swift Testing (parallel or not, it has a single entry point.)
327327
if options.testLibraryOptions.isEnabled(.swiftTesting) {
328-
if options.testLibraryOptions.isExplicitlyEnabled(.swiftTesting) != true,
329-
let testEntryPointPath = testProducts.lazy.compactMap(\.testEntryPointPath).first {
330-
// Cannot run Swift Testing because an entry point file was used.
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.
331332
swiftCommandState.observabilityScope.emit(
332333
debug: "Skipping automatic Swift Testing invocation because a test entry point path is present: \(testEntryPointPath)"
333334
)
@@ -733,9 +734,10 @@ extension SwiftTestCommand {
733734
}
734735

735736
if testLibraryOptions.isEnabled(.swiftTesting) {
736-
if testLibraryOptions.isExplicitlyEnabled(.swiftTesting) != true,
737-
let testEntryPointPath = testProducts.lazy.compactMap(\.testEntryPointPath).first {
738-
// Cannot run Swift Testing because an entry point file was used.
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.
739741
swiftCommandState.observabilityScope.emit(
740742
debug: "Skipping automatic Swift Testing invocation (list) because a test entry point path is present: \(testEntryPointPath)"
741743
)

0 commit comments

Comments
 (0)