Skip to content

[flutter_tools] Stop output_web_test from hanging when flutter run fails - #194259

Closed
mdebbar wants to merge 1 commit into
flutter:masterfrom
mdebbar:fix-output-web-test-hang
Closed

mdebbar wants to merge 1 commit into
flutter:masterfrom
mdebbar:fix-output-web-test-hang

Conversation

@mdebbar

@mdebbar mdebbar commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

When flutter run exits early, output_web_test.dart hangs until the 15-minute test timeout. The test sets up expectLater(flutter.stdout, emitsThrough(...)) before starting the app. expectLater marks the test as pending until the stream matcher completes, and flutter.stdout is a broadcast stream that never closes. So once flutter run dies, the test can only end by timing out.

Example CI failure (flutter run exits after ~7s, then the test times out at 15m):

This PR listens to stdout with a plain subscription instead, and checks the result after flutter.stop(). Locally, forcing an early failure with --web-port=1 now fails in 3s, where it previously ran until the timeout.

Related to #185452. The underlying flutter run failure is fixed in DWDS by dart-lang/webdev#2877.

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Oct 12, 2026
@github-actions github-actions Bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Oct 12, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors a web shard test in output_web_test.dart to avoid using expectLater on flutter.stdout, which does not close and can cause tests to hang if flutter run fails early. Instead, it introduces a StreamSubscription to listen to the stdout stream, updates a boolean flag when the expected metadata is loaded, ensures the subscription is cancelled in a teardown block, and asserts the flag's value at the end of the test. I have no feedback to provide on these changes.

@mdebbar mdebbar closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant