Get reasonable output when a stream test fails. (#154377)
Debugging https://github.com/flutter/flutter/issues/154268 was hard; when I removed `--disable-dart-dev` I would get the following error from this test: <img width="627" alt="Screenshot 2024-08-29 at 4 25 43â¯PM" src="https://github.com/user-attachments/assets/2cc3266e-cc6e-425f-b909-12d7556ff110"> After my change, this is what the error looks like: <img width="1055" alt="Screenshot 2024-08-29 at 4 26 50â¯PM" src="https://github.com/user-attachments/assets/8b0ecccc-a7c9-4da7-bf22-15cef24c4cc7"> In general we should embrace more of the test package and matchers when appropriate.
This commit is contained in:
parent
284d289425
commit
f070ffc53b
@ -80,9 +80,16 @@ void main() {
|
||||
'--no-terminate-stray-dart-processes',
|
||||
'-t', 'smoke_test_setup_failure',
|
||||
]);
|
||||
await process.stdout.transform(utf8.decoder).where(
|
||||
(String line) => line.contains('VM service still not ready. It is possible the target has failed')
|
||||
).first;
|
||||
|
||||
// If this test fails, the reason is usually buried in stderr.
|
||||
final Stream<String> stderr = process.stderr.transform(utf8.decoder);
|
||||
stderr.listen(printOnFailure);
|
||||
|
||||
final Stream<String> stdout = process.stdout.transform(utf8.decoder);
|
||||
await expectLater(
|
||||
stdout,
|
||||
emitsThrough(contains('VM service still not ready. It is possible the target has failed')),
|
||||
);
|
||||
expect(process.kill(), isTrue);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user