@@ -104,6 +104,7 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
104104 // The set of matching tests (or, in the case of `swift test list`, the set
105105 // of all tests.)
106106 var tests = [ Test] ( )
107+ var libraries = [ Library] ( )
107108
108109 if args. listTests == true {
109110 tests = await Array ( Test . all)
@@ -126,18 +127,19 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
126127 }
127128 } else if args. experimentalListLibraries == true {
128129#if !SWT_NO_RUNTIME_LIBRARY_DISCOVERY
129- let libraries = Library . all
130+ libraries = Array ( Library . all)
130131#else
131- let libraries = [ Library . swiftTesting]
132+ libraries = [ Library . swiftTesting]
132133#endif
133134
134135 if args. verbosity > . min {
135136 for library in libraries {
136137 // Print the test ID to stdout (classical CLI behavior.)
138+ let libraryDescription = " \( library. name) (swift test --experimental-testing-library \( library. canonicalHint) ) "
137139#if SWT_TARGET_OS_APPLE && !SWT_NO_FILE_IO
138- try ? FileHandle . stdout. write ( " \( library . name ) ( \( library . canonicalHint ) ) \n " )
140+ try ? FileHandle . stdout. write ( " \( libraryDescription ) \n " )
139141#else
140- print ( " \( library . name ) ( \( library . canonicalHint ) ) " )
142+ print ( libraryDescription )
141143#endif
142144 }
143145 }
@@ -156,7 +158,7 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
156158 // If there were no matching tests, exit with a dedicated exit code so that
157159 // the caller (assumed to be Swift Package Manager) can implement special
158160 // handling.
159- if tests. isEmpty {
161+ if tests. isEmpty && libraries . isEmpty {
160162 exitCode. withLock { exitCode in
161163 if exitCode == EXIT_SUCCESS {
162164 exitCode = EXIT_NO_TESTS_FOUND
0 commit comments