@@ -1190,10 +1190,12 @@ struct TestCommandTests {
1190
1190
1191
1191
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1192
1192
1193
- let errorDescription = outputStream. bytes. description
1193
+ // The output stream is written to asynchronously on a DispatchQueue and can
1194
+ // receive output after the command has thrown.
1195
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --parallel " )
1194
1196
#expect(
1195
- errorDescription . contains ( " --debugger cannot be used with --parallel " ) ,
1196
- " Expected error about incompatible flags, got: \( errorDescription ) "
1197
+ found ,
1198
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1197
1199
)
1198
1200
}
1199
1201
@@ -1209,11 +1211,11 @@ struct TestCommandTests {
1209
1211
1210
1212
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1211
1213
1212
- let errorDescription = outputStream. bytes. description
1213
1214
// Should hit the --parallel error first since validation is done in order
1215
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --parallel " )
1214
1216
#expect(
1215
- errorDescription . contains ( " --debugger cannot be used with --parallel " ) ,
1216
- " Expected error about incompatible flags, got: \( errorDescription ) "
1217
+ found ,
1218
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1217
1219
)
1218
1220
}
1219
1221
@@ -1229,10 +1231,10 @@ struct TestCommandTests {
1229
1231
1230
1232
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1231
1233
1232
- let errorDescription = outputStream. bytes . description
1234
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --num-workers " )
1233
1235
#expect(
1234
- errorDescription . contains ( " --debugger cannot be used with --num-workers " ) ,
1235
- " Expected error about incompatible flags, got: \( errorDescription ) "
1236
+ found ,
1237
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1236
1238
)
1237
1239
}
1238
1240
@@ -1248,10 +1250,10 @@ struct TestCommandTests {
1248
1250
1249
1251
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1250
1252
1251
- let errorDescription = outputStream. bytes . description
1253
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --list-tests " )
1252
1254
#expect(
1253
- errorDescription . contains ( " --debugger cannot be used with --list-tests " ) ,
1254
- " Expected error about incompatible flags, got: \( errorDescription ) "
1255
+ found ,
1256
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1255
1257
)
1256
1258
}
1257
1259
@@ -1267,10 +1269,10 @@ struct TestCommandTests {
1267
1269
1268
1270
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1269
1271
1270
- let errorDescription = outputStream. bytes . description
1272
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --show-codecov-path " )
1271
1273
#expect(
1272
- errorDescription . contains ( " --debugger cannot be used with --show-codecov-path " ) ,
1273
- " Expected error about incompatible flags, got: \( errorDescription ) "
1274
+ found ,
1275
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1274
1276
)
1275
1277
}
1276
1278
@@ -1286,10 +1288,10 @@ struct TestCommandTests {
1286
1288
1287
1289
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1288
1290
1289
- let errorDescription = outputStream. bytes . description
1291
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with release configuration " )
1290
1292
#expect(
1291
- errorDescription . contains ( " --debugger cannot be used with release configuration " ) ,
1292
- " Expected error about incompatible flags, got: \( errorDescription ) "
1293
+ found ,
1294
+ " Expected error about incompatible flags, got: \( outputStream . bytes . description ) "
1293
1295
)
1294
1296
}
1295
1297
0 commit comments