Skip to content

Commit

Permalink
Fix broken link and test cover. (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c authored Aug 24, 2024
1 parent 7605342 commit df38455
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 4 deletions.
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

0 comments on commit df38455

Please sign in to comment.