@@ -1194,10 +1194,12 @@ struct TestCommandTests {
1194
1194
1195
1195
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1196
1196
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 " )
1198
1200
#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 ) "
1201
1203
)
1202
1204
}
1203
1205
@@ -1213,11 +1215,11 @@ struct TestCommandTests {
1213
1215
1214
1216
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1215
1217
1216
- let errorDescription = outputStream. bytes. description
1217
1218
// 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 " )
1218
1220
#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 ) "
1221
1223
)
1222
1224
}
1223
1225
@@ -1233,10 +1235,10 @@ struct TestCommandTests {
1233
1235
1234
1236
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1235
1237
1236
- let errorDescription = outputStream. bytes . description
1238
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --num-workers " )
1237
1239
#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 ) "
1240
1242
)
1241
1243
}
1242
1244
@@ -1252,10 +1254,10 @@ struct TestCommandTests {
1252
1254
1253
1255
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1254
1256
1255
- let errorDescription = outputStream. bytes . description
1257
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --list-tests " )
1256
1258
#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 ) "
1259
1261
)
1260
1262
}
1261
1263
@@ -1271,10 +1273,10 @@ struct TestCommandTests {
1271
1273
1272
1274
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1273
1275
1274
- let errorDescription = outputStream. bytes . description
1276
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with --show-codecov-path " )
1275
1277
#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 ) "
1278
1280
)
1279
1281
}
1280
1282
@@ -1290,10 +1292,10 @@ struct TestCommandTests {
1290
1292
1291
1293
#expect( error == ExitCode . failure, " Expected ExitCode.failure, got \( String ( describing: error) ) " )
1292
1294
1293
- let errorDescription = outputStream. bytes . description
1295
+ let found = try await waitForOutputStreamToContain ( outputStream, " --debugger cannot be used with release configuration " )
1294
1296
#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 ) "
1297
1299
)
1298
1300
}
1299
1301
0 commit comments