-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team
Description
Discovered while working on #150575
See
flutter/packages/flutter_tools/test/src/testbed.dart
Lines 30 to 46 in 240825a
| // A default value should be provided if the vast majority of tests should use | |
| // this provider. For example, [BufferLogger], [MemoryFileSystem]. | |
| final Map<Type, Generator> _testbedDefaults = <Type, Generator>{ | |
| // Keeps tests fast by avoiding the actual file system. | |
| FileSystem: () => MemoryFileSystem(style: globals.platform.isWindows ? FileSystemStyle.windows : FileSystemStyle.posix), | |
| ProcessManager: () => FakeProcessManager.any(), | |
| Logger: () => BufferLogger( | |
| terminal: AnsiTerminal(stdio: globals.stdio, platform: globals.platform), // Danger, using real stdio. | |
| outputPreferences: OutputPreferences.test(), | |
| ), // Allows reading logs and prevents stdout. | |
| OperatingSystemUtils: () => FakeOperatingSystemUtils(), | |
| OutputPreferences: () => OutputPreferences.test(), // configures BufferLogger to avoid color codes. | |
| Usage: () => TestUsage(), // prevent addition of analytics from burdening test mocks | |
| FlutterVersion: () => FakeFlutterVersion(), // prevent requirement to mock git for test runner. | |
| Signals: () => FakeSignals(), // prevent registering actual signal handlers. | |
| Pub: () => ThrowingPub(), // prevent accidental invocations of pub. | |
| }; |
TestBed isn't a construct used too often in tool tests in nowadays, but I noticed it includes a stub for Usage, but not for Analytics (from package:unified_analytics). Usage is deprecated, the backend is offline (to my knowledge), and has been replaced by Analytics (see #128251).
This context-injected stub of Usage should probably be replaced with one for Analytics, otherwise, tests using TestBed might be sending analytics events.
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listteam-toolOwned by Flutter Tool teamOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.triaged-toolTriaged by Flutter Tool teamTriaged by Flutter Tool team