|
5 | 5 | import 'package:file/file.dart';
|
6 | 6 | import 'package:file/memory.dart';
|
7 | 7 | import 'package:flutter_tools/src/base/file_system.dart';
|
| 8 | +import 'package:flutter_tools/src/base/logger.dart'; |
8 | 9 | import 'package:flutter_tools/src/cache.dart';
|
9 | 10 | import 'package:flutter_tools/src/commands/update_packages.dart';
|
10 | 11 | import 'package:flutter_tools/src/dart/pub.dart';
|
@@ -88,9 +89,11 @@ void main() {
|
88 | 89 | late Directory flutter;
|
89 | 90 | late FakePub pub;
|
90 | 91 | late FakeProcessManager processManager;
|
| 92 | + late BufferLogger logger; |
91 | 93 |
|
92 | 94 | setUpAll(() {
|
93 | 95 | Cache.disableLocking();
|
| 96 | + logger = BufferLogger.test(); |
94 | 97 | });
|
95 | 98 |
|
96 | 99 | setUp(() {
|
@@ -174,6 +177,35 @@ void main() {
|
174 | 177 | ),
|
175 | 178 | });
|
176 | 179 |
|
| 180 | + testUsingContext('--transitive-closure --consumer-only', () async { |
| 181 | + final UpdatePackagesCommand command = UpdatePackagesCommand(); |
| 182 | + await createTestCommandRunner(command).run(<String>[ |
| 183 | + 'update-packages', |
| 184 | + '--transitive-closure', |
| 185 | + '--consumer-only', |
| 186 | + ]); |
| 187 | + expect(pub.pubGetDirectories, equals(<String>[ |
| 188 | + '/.tmp_rand0/flutter_update_packages.rand0/synthetic_package', |
| 189 | + ])); |
| 190 | + expect(pub.pubBatchDirectories, equals(<String>[ |
| 191 | + '/.tmp_rand0/flutter_update_packages.rand0/synthetic_package', |
| 192 | + ])); |
| 193 | + // Expecting a line like: |
| 194 | + // 'flutter -> {collection, meta, typed_data, vector_math}' |
| 195 | + expect( |
| 196 | + logger.statusText, |
| 197 | + contains(RegExp(r'flutter -> {([a-z_]+, )*([a-z_]+)+}')), |
| 198 | + ); |
| 199 | + }, overrides: <Type, Generator>{ |
| 200 | + Pub: () => pub, |
| 201 | + FileSystem: () => fileSystem, |
| 202 | + ProcessManager: () => processManager, |
| 203 | + Cache: () => Cache.test( |
| 204 | + processManager: processManager, |
| 205 | + ), |
| 206 | + Logger: () => logger, |
| 207 | + }); |
| 208 | + |
177 | 209 | testUsingContext('force updates packages --synthetic-package-path', () async {
|
178 | 210 | final UpdatePackagesCommand command = UpdatePackagesCommand();
|
179 | 211 | const String dir = '/path/to/synthetic/package';
|
|
0 commit comments