Repository navigation
Replies: 1 comment 2 replies
This shouldn't pass. Caching errors inside widgets has no impact on whether the exception is considered caught or not. Looks like there's a bug that cause a silent exception to be allowed. |
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue with automatic retry in Riverpod 3 in tests
Problem
Hi,
I've observed unexpected behavior with Riverpod's automatic retry mechanism in my Flutter tests. When using
pumpAndSettle()with a long duration (e.g., 30 seconds) to wait for asynchronous operations to complete, automatic retries generate multiple exceptions that escape thetry-catchblock in my widget and cause the test to fail with the error "Multiple exceptions (3) were detected during the running of the current test, and at least one was unexpected."Observed behavior
pumpAndSettle()without duration, retries don't complete before the test ends, so no error occurspumpAndSettle(Duration(seconds: 30)), retries complete and generate multiple exceptions that bubble up to the test frameworkretry: (_, __) => null, the test passes even with a long durationQuestion
In my applications, I often need to wait for asynchronous calls in my tests, which requires using
pumpAndSettle()with a sufficient duration. In these cases, tests fail due to automatic retries => but it works in my application because I can wait for the retryShould automatic retry be systematically disabled in tests with Riverpod? Is there a recommended best practice for handling this case?
Reproducible example
All reactions