Skip to content

Commit ffa4d0f

Browse files
authored
Do not write to stderr when testing swift test list. (#533)
When testing the JSON ABI _vis-à-vis_ `swift test list`, we're writing to `stderr`. For the purposes of our tests, this is just noise, so block output to `stderr` from the `list` subcommand if verbosity is set to `.min` (as it is in the tests.) ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent 55ca2b7 commit ffa4d0f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Sources/Testing/ABI/EntryPoints/EntryPoint.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ func entryPoint(passing args: __CommandLineArguments_v0?, eventHandler: Event.Ha
7676

7777
if args.listTests ?? false {
7878
let tests = await Test.all
79-
for testID in listTestsForEntryPoint(tests) {
80-
// Print the test ID to stdout (classical CLI behavior.)
79+
if args.verbosity > .min {
80+
for testID in listTestsForEntryPoint(tests) {
81+
// Print the test ID to stdout (classical CLI behavior.)
8182
#if SWT_TARGET_OS_APPLE && !SWT_NO_FILE_IO
82-
try? FileHandle.stdout.write("\(testID)\n")
83+
try? FileHandle.stdout.write("\(testID)\n")
8384
#else
84-
print(testID)
85+
print(testID)
8586
#endif
87+
}
8688
}
8789

8890
// Post an event for every discovered test. These events are turned into

0 commit comments

Comments
 (0)