-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove test
package when already flutter_test
is used
#425
Conversation
Visit the preview URL for this PR (updated for commit b08f2b5): https://sharezone-test--pr425-remove-duplicated-te-78yky3nx.web.app (expires Wed, 15 Mar 2023 12:23:36 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4cb3ae61e1e018abfd9841fd3239f5b49ccc034b |
timeout: Timeout( | ||
Duration(seconds: 5), | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Jonas-Sander Do you know what the reason for using timeout
was?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know for sure anymore.
My guess is that because it's a bloc and thus it uses async events that instead of tests just failing they will wait indefinitely for an event that has yet to come (that is expected). So instead of letting the tests/ci-job run for until the default timeout is hit, we use a short timeout instead (I think the default is maybe like 10 mins or sth?).
I think this is actually useful, we should keep it imo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default should be 30 seconds:
By default, tests will time out after 30 seconds of inactivity. The timeout applies to deadlocks or cases where the test stops making progress, it does not ensure that an overall test case or test suite completes within any set time.
https://github.com/dart-lang/test/tree/master/pkgs/test#timeouts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For unit tests (test()
) it's 30 seconds, for widget tests (testWidgets()
) it's 10 minutes (uses TestWidgetsFlutterBinding.defaultTestTimeout
which is set to 10 minutes, see: https://api.flutter.dev/flutter/flutter_test/TestWidgetsFlutterBinding/defaultTestTimeout.html).
Demo: https://zapp.run/edit/flutter-zn8a0669n8b0?entry=test/widget_test.dart&file=test/widget_test.dart
In this file we are only using unit tests (test
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, ok
When we already use the
flutter_test
package, importing thetest
package as well is unnecessary.