flutter/packages
auto-submit[bot] 49f45d2095
Reverts "Fail tests on exceptions raised after test completed (#144706)" (#144970)
Reverts: flutter/flutter#144706
Initiated by: gspencergoog
Reason for reverting: This has broken the tree because some tests are still failing post completion. This particular one looks like it might have to do with a gold image not existing.
Original PR Author: goderbauer

Reviewed By: {Piinks}

This change reverts the following previous change:
A test was failing silently because of this (see https://github.com/flutter/flutter/issues/144353 and fixed in https://github.com/flutter/flutter/pull/144709). The failure went undetected for months. Ideally, this should have been a regular non-silent failure. This change makes that so. `package:test` can properly handle reported exceptions outside of test cases. With this change, the test fails as follows:

```
00:03 +82: Smoke test material/color_scheme/dynamic_content_color.0.dart
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test (but after the test had completed):
setState() called after dispose(): _DynamicColorExampleState#1cd37(lifecycle state: defunct, not
mounted)
This error happens if you call setState() on a State object for a widget that no longer appears in
the widget tree (e.g., whose parent widget no longer includes the widget in its build). This error
can occur when code calls setState() from a timer or an animation callback.
The preferred solution is to cancel the timer or stop listening to the animation in the dispose()
callback. Another solution is to check the "mounted" property of this object before calling
setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is
retaining a reference to this State object after it has been removed from the tree. To avoid memory
leaks, consider breaking the reference to this object during dispose().

When the exception was thrown, this was the stack:
#0      State.setState.<anonymous closure> (package:flutter/src/widgets/framework.dart:1167:9)
#1      State.setState (package:flutter/src/widgets/framework.dart:1202:6)
#2      _DynamicColorExampleState._updateImage (package:flutter_api_samples/material/color_scheme/dynamic_content_color.0.dart:191:5)
<asynchronous suspension>
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +81 -1: Smoke test material/context_menu/context_menu_controller.0.dart
00:03 +81 -1: Smoke test material/color_scheme/dynamic_content_color.0.dart [E]
  Test failed. See exception logs above.
  The test description was: Smoke test material/color_scheme/dynamic_content_color.0.dart
  
  This test failed after it had already completed.
  Make sure to use a matching library which informs the test runner
  of pending async work.
```
2024-03-11 23:31:18 +00:00
..
flutter Make TabController communicating creation in constructor. (#144912) 2024-03-11 23:13:47 +00:00
flutter_driver Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
flutter_goldens Rename isAvailableForEnvironment to isForEnvironment (#143176) (#144858) 2024-03-10 06:20:38 +00:00
flutter_localizations Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
flutter_test Reverts "Fail tests on exceptions raised after test completed (#144706)" (#144970) 2024-03-11 23:31:18 +00:00
flutter_tools Refactoring if chains into switch statements (#144905) 2024-03-11 23:04:57 +00:00
flutter_web_plugins Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
fuchsia_remote_debug_protocol Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
integration_test Upgrade vm_service. (#144845) 2024-03-08 17:09:07 -08:00
analysis_options.yaml Unify analysis options (#108462) 2022-07-28 09:07:49 -07:00