• auto-submit[bot]'s avatar
    Reverts "Fail tests on exceptions raised after test completed (#144706)" (#144970) · 49f45d20
    auto-submit[bot] authored
    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.
    ```
    49f45d20
test.dart 97.4 KB