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

Fix broken link and test cover. #242

Merged
merged 6 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/leak_tracking/TROUBLESHOOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,25 @@ testWidgets('async onInit throws FlutterError',
...
```

## Convert the leak to tech debt

If the leak is complicated and the test failure blocks important process,
temporary turn off leak tracking and create issue to fix the leak and re-enable leak tracking.

* For one test, add parameter to `testWidgets`:
```
// TODO ...
experimentalLeakTesting: LeakTesting.settings.withIgnoredAll(),

* For a test suite, add line to the test's `main`:
```
// TODO ...
LeakTesting.settings = LeakTesting.settings.withIgnoredAll();
```

* For all tests, update[`test/flutter_test_config.dart`](https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html) to not invoke `LeakTesting.enable();`


## Get additional information

To understand the root cause of a memory leak, you may want to gather additional information.
Expand Down
4 changes: 4 additions & 0 deletions pkgs/leak_tracker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 10.0.7

* Fix broken link in error message.

# 10.0.6

* Handle double tracking.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/leak_tracker/lib/src/shared/_primitives.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final leakTrackerYamlHeader = '''
/// The enum is test covered to catch broken links.
enum Links {
gitHubTroubleshooting(
'https://github.com/dart-lang/leak_tracker/blob/main/doc/TROUBLESHOOT.md',
'https://github.com/dart-lang/leak_tracker/blob/main/doc/leak_tracking/TROUBLESHOOT.md',
null,
),
;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/leak_tracker/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: leak_tracker
version: 10.0.6
version: 10.0.7
description: A framework for memory leak tracking for Dart and Flutter applications.
repository: https://github.com/dart-lang/leak_tracker/tree/main/pkgs/leak_tracker

Expand Down
3 changes: 3 additions & 0 deletions pkgs/leak_tracker/test/tests/shared/_primitives_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ void main() {
for (final link in Links.values) {
test('$link is not broken', () async {
final content = await loadPageHtmlContent(link.value);

expect(content, isNot(contains('"title":"File not found"')));

final hash = link.hash;
if (hash != null) {
expect(content, contains('href="#$hash"'));
Expand Down
4 changes: 4 additions & 0 deletions pkgs/leak_tracker_flutter_testing/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.7

* Upgrade leak_tracker to 10.0.7.

## 3.0.6

* Upgrade leak_tracker to 10.0.6.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/leak_tracker_flutter_testing/lib/src/matchers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Future<List<ObjectEvent>> memoryEvents(
return events;
}

/// Checks if Iterable<ObjectEvent> contains two events,
/// Checks if `Iterable<ObjectEvent>` contains two events,
/// first `ObjectCreated` and then `ObjectDisposed`.
Matcher areCreateAndDispose = const _AreCreateAndDispose();

Expand Down
2 changes: 1 addition & 1 deletion pkgs/leak_tracker_flutter_testing/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: leak_tracker_flutter_testing
version: 3.0.6
version: 3.0.7
description: An internal package to test leak tracking with Flutter.
repository: https://github.com/dart-lang/leak_tracker/tree/main/pkgs/leak_tracker_flutter_testing

Expand Down