Skip to content

Commit afdc484

Browse files
add test of flutter update-packages --transitive-closure --consumer-only (#116747)
1 parent 117a83a commit afdc484

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

packages/flutter_tools/test/commands.shard/hermetic/update_packages_test.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'package:file/file.dart';
66
import 'package:file/memory.dart';
77
import 'package:flutter_tools/src/base/file_system.dart';
8+
import 'package:flutter_tools/src/base/logger.dart';
89
import 'package:flutter_tools/src/cache.dart';
910
import 'package:flutter_tools/src/commands/update_packages.dart';
1011
import 'package:flutter_tools/src/dart/pub.dart';
@@ -88,9 +89,11 @@ void main() {
8889
late Directory flutter;
8990
late FakePub pub;
9091
late FakeProcessManager processManager;
92+
late BufferLogger logger;
9193

9294
setUpAll(() {
9395
Cache.disableLocking();
96+
logger = BufferLogger.test();
9497
});
9598

9699
setUp(() {
@@ -174,6 +177,35 @@ void main() {
174177
),
175178
});
176179

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+
177209
testUsingContext('force updates packages --synthetic-package-path', () async {
178210
final UpdatePackagesCommand command = UpdatePackagesCommand();
179211
const String dir = '/path/to/synthetic/package';

0 commit comments

Comments
 (0)