Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
59242b75
Unverified
Commit
59242b75
authored
Jan 02, 2024
by
Polina Cherkasova
Committed by
GitHub
Jan 02, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add command line parameter that turns on leak tracking. (#138653)
parent
c56bea32
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
flutter_test_config.dart
packages/flutter/test/flutter_test_config.dart
+19
-3
No files found.
packages/flutter/test/flutter_test_config.dart
View file @
59242b75
...
...
@@ -11,6 +11,17 @@ import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
import
'_goldens_io.dart'
if
(
dart
.
library
.
html
)
'_goldens_web.dart'
as
flutter_goldens
;
/// If true, leak tracking will be enabled for all tests `testWidgetsWithLeakTracking`.
///
/// By default, the constant is false.
/// To enable the leak tracking for all tests, either pass the compilation flag
/// `--dart-define=flutter_test_config.leak_tracking=true` or
/// temporarily pass `defaultValue = true` to `fromEnvironment` in the constant definition.
///
/// To enable leak tracking for an individual test file, add the line to the test `main`:
/// `LeakTesting.settings = LeakTesting.settings.withTrackedAll()`.
const
bool
_kLeakTracking
=
bool
.
fromEnvironment
(
'LEAK_TRACKING'
);
/// Test configuration for each test library in this directory.
///
/// See https://api.flutter.dev/flutter/flutter_test/flutter_test-library.html.
...
...
@@ -25,11 +36,10 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) {
LeakTracking
.
warnForUnsupportedPlatforms
=
false
;
// TODO(polina-c): clean up leaks and stop ignoring them.
// https://github.com/flutter/flutter/issues/137311
// Leak tracking is off by default. To temporary enable it add `.withTrackedAll()` after `settings`.
LeakTesting
.
settings
=
LeakTesting
.
settings
// TODO(polina-c): clean up leaks and stop ignoring them.
// https://github.com/flutter/flutter/issues/137311
.
withIgnored
(
allNotGCed:
true
,
notDisposed:
<
String
,
int
?>{
...
...
@@ -37,6 +47,12 @@ Future<void> testExecutable(FutureOr<void> Function() testMain) {
},
);
// Leak tracking is off by default.
// To enable it, follow doc for [_kLeakTracking].
if
(
_kLeakTracking
)
{
LeakTesting
.
settings
=
LeakTesting
.
settings
.
withTrackedAll
();
}
// Enable golden file testing using Skia Gold.
return
flutter_goldens
.
testExecutable
(
testMain
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment