Skip to content
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

Merged
merged 11 commits into from
Mar 8, 2023

Conversation

nilsreichardt
Copy link
Member

When we already use the flutter_test package, importing the test package as well is unnecessary.

@nilsreichardt nilsreichardt added testing refactoring Restructuring and cleaning up existing code without changing its existing behaviour. labels Mar 7, 2023
@github-actions github-actions bot added dependencies Changing, updating, adding or removing one or more dependencies. and removed testing labels Mar 7, 2023
@github-actions
Copy link

github-actions bot commented Mar 7, 2023

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

@nilsreichardt nilsreichardt marked this pull request as draft March 7, 2023 17:47
@nilsreichardt nilsreichardt marked this pull request as ready for review March 7, 2023 18:40
Comment on lines -837 to -839
timeout: Timeout(
Duration(seconds: 5),
),
Copy link
Member Author

@nilsreichardt nilsreichardt Mar 7, 2023

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?

Copy link
Collaborator

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.

Copy link
Member Author

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

Copy link
Member Author

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).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, ok

@nilsreichardt nilsreichardt enabled auto-merge (squash) March 8, 2023 11:11
@nilsreichardt nilsreichardt merged commit e9ea995 into main Mar 8, 2023
@nilsreichardt nilsreichardt deleted the remove-duplicated-test-package branch March 8, 2023 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Changing, updating, adding or removing one or more dependencies. refactoring Restructuring and cleaning up existing code without changing its existing behaviour. testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants