-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[go_router] Migrates test for leak testing #10276
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
base: main
Are you sure you want to change the base?
Conversation
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.
Code Review
This pull request migrates a test to include leak testing, specifically ignoring TestRestorationManager and RestorationBucket classes. This change aims to improve the reliability and robustness of the go_router package by ensuring that state restoration works correctly without introducing memory leaks.
| testWidgets( | ||
| 'Restores state correctly', | ||
| // TODO(Flop): Remove when minimum flutter version includes | ||
| // https://github.com/flutter/flutter/pull/176519 | ||
| experimentalLeakTesting: LeakTesting.settings.withIgnored( | ||
| classes: <String>['TestRestorationManager', 'RestorationBucket'], | ||
| ), |
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.
The experimentalLeakTesting parameter is used to ignore specific classes during leak testing. While this can be useful for suppressing known leaks or focusing on specific areas, it's important to ensure that these ignored classes are genuinely not a concern and won't cause issues in the long run. Consider adding a comment explaining why these classes are being ignored and under what circumstances it's safe to ignore them.
Additionally, it's good to link to the specific issue or discussion where this decision was made, if applicable.
'Restores state correctly',
// TODO(Flop): Remove when minimum flutter version includes
// https://github.com/flutter/flutter/pull/176519
// Ignoring RestorationBucket and TestRestorationManager due to known issues with restoration.
// See [link to issue or discussion] for more details.
experimentalLeakTesting: LeakTesting.settings.withIgnored(
classes: <String>['TestRestorationManager', 'RestorationBucket'],
),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.
LGTM except for the username of the TODO. In any case, I think it is better if @chunhtai is the one providing the approval
| // TODO(Flop): Remove when minimum flutter version includes | ||
| // https://github.com/flutter/flutter/pull/176519 |
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.
Who is Flop? I think we are supposed to put our own username here (in that case, yours).
@chunhtai, what is the best to do here?
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.
yes please use your username here.
Otherwise, adding this exception sound fine to me
| 'Restores state correctly', | ||
| // TODO(Flop): Remove when minimum flutter version includes | ||
| // https://github.com/flutter/flutter/pull/176519 | ||
| experimentalLeakTesting: LeakTesting.settings.withIgnored( |
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.
we should put this after the test body
| // TODO(Flop): Remove when minimum flutter version includes | ||
| // https://github.com/flutter/flutter/pull/176519 |
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.
yes please use your username here.
Otherwise, adding this exception sound fine to me
|
@ValentinVignal @chunhtai Thank you, I may have overlooked this part of the documentation. I have changed it to my username, and I will find time later to submit a PR to complete the migration. |
migrating test for
flutter/flutter#176519
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3