@@ -1194,10 +1194,12 @@ struct TestCommandTests {
11941194
11951195 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
11961196
1197- let errorDescription = outputStream. bytes. description
1197+ // The output stream is written to asynchronously on a DispatchQueue and can
1198+ // receive output after the command has thrown.
1199+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --parallel " )
11981200 #expect(
1199- errorDescription . contains ( " --debugger cannot be used with --parallel " ) ,
1200- " Expected error about incompatible flags, got: \( errorDescription ) "
1201+ found ,
1202+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12011203 )
12021204 }
12031205
@@ -1213,11 +1215,11 @@ struct TestCommandTests {
12131215
12141216 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
12151217
1216- let errorDescription = outputStream. bytes. description
12171218 // Should hit the --parallel error first since validation is done in order
1219+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --parallel " )
12181220 #expect(
1219- errorDescription . contains ( " --debugger cannot be used with --parallel " ) ,
1220- " Expected error about incompatible flags, got: \( errorDescription ) "
1221+ found ,
1222+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12211223 )
12221224 }
12231225
@@ -1233,10 +1235,10 @@ struct TestCommandTests {
12331235
12341236 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
12351237
1236- let errorDescription = outputStream. bytes . description
1238+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --num-workers " )
12371239 #expect(
1238- errorDescription . contains ( " --debugger cannot be used with --num-workers " ) ,
1239- " Expected error about incompatible flags, got: \( errorDescription ) "
1240+ found ,
1241+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12401242 )
12411243 }
12421244
@@ -1252,10 +1254,10 @@ struct TestCommandTests {
12521254
12531255 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
12541256
1255- let errorDescription = outputStream. bytes . description
1257+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --list-tests " )
12561258 #expect(
1257- errorDescription . contains ( " --debugger cannot be used with --list-tests " ) ,
1258- " Expected error about incompatible flags, got: \( errorDescription ) "
1259+ found ,
1260+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12591261 )
12601262 }
12611263
@@ -1271,10 +1273,10 @@ struct TestCommandTests {
12711273
12721274 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
12731275
1274- let errorDescription = outputStream. bytes . description
1276+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --show-codecov-path " )
12751277 #expect(
1276- errorDescription . contains ( " --debugger cannot be used with --show-codecov-path " ) ,
1277- " Expected error about incompatible flags, got: \( errorDescription ) "
1278+ found ,
1279+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12781280 )
12791281 }
12801282
@@ -1290,10 +1292,10 @@ struct TestCommandTests {
12901292
12911293 #expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
12921294
1293- let errorDescription = outputStream. bytes . description
1295+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with release configuration " )
12941296 #expect(
1295- errorDescription . contains ( " --debugger cannot be used with release configuration " ) ,
1296- " Expected error about incompatible flags, got: \( errorDescription ) "
1297+ found ,
1298+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
12971299 )
12981300 }
12991301
0 commit comments