Unit tests don't fail if an exception is thrown inside ChangeNotifier callback #116653
Labels
a: tests
"flutter test", flutter_test, or one of our tests
found in release: 3.3
Found to occur in 3.3
found in release: 3.7
Found to occur in 3.7
framework
flutter/packages/flutter repository. See also f: labels.
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
P2
Important issues not at the top of the work list
team-framework
Owned by Framework team
triaged-framework
Triaged by Framework team
Steps to Reproduce
Actual results:
Expected results:
I assume, that the issue is, that inside ChangeNotifier callback errors are caught and not propagated to the test runner.
If I set the error reporter explicitly like so:
At the beginning of the test, the test fails as I would expect it to.
Code sample
Logs
This will log something like this:
Update 1:
if I use testWidgets(...) instead of test(...) the test behaves as expected and fails. So it seems to me that the configuration of the error reporter is missing inside the test method.
Maybe this is somehow intended, but at least from my perspective it is not clear, why the test of a plain ChangeNotifier should be a widget test.
The text was updated successfully, but these errors were encountered: