Unverified Commit afdc4840 authored by Christopher Fujino's avatar Christopher Fujino Committed by GitHub

add test of flutter update-packages --transitive-closure --consumer-only (#116747)

parent 117a83a4
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/cache.dart'; import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/update_packages.dart'; import 'package:flutter_tools/src/commands/update_packages.dart';
import 'package:flutter_tools/src/dart/pub.dart'; import 'package:flutter_tools/src/dart/pub.dart';
...@@ -88,9 +89,11 @@ void main() { ...@@ -88,9 +89,11 @@ void main() {
late Directory flutter; late Directory flutter;
late FakePub pub; late FakePub pub;
late FakeProcessManager processManager; late FakeProcessManager processManager;
late BufferLogger logger;
setUpAll(() { setUpAll(() {
Cache.disableLocking(); Cache.disableLocking();
logger = BufferLogger.test();
}); });
setUp(() { setUp(() {
...@@ -174,6 +177,35 @@ void main() { ...@@ -174,6 +177,35 @@ void main() {
), ),
}); });
testUsingContext('--transitive-closure --consumer-only', () async {
final UpdatePackagesCommand command = UpdatePackagesCommand();
await createTestCommandRunner(command).run(<String>[
'update-packages',
'--transitive-closure',
'--consumer-only',
]);
expect(pub.pubGetDirectories, equals(<String>[
'/.tmp_rand0/flutter_update_packages.rand0/synthetic_package',
]));
expect(pub.pubBatchDirectories, equals(<String>[
'/.tmp_rand0/flutter_update_packages.rand0/synthetic_package',
]));
// Expecting a line like:
// 'flutter -> {collection, meta, typed_data, vector_math}'
expect(
logger.statusText,
contains(RegExp(r'flutter -> {([a-z_]+, )*([a-z_]+)+}')),
);
}, overrides: <Type, Generator>{
Pub: () => pub,
FileSystem: () => fileSystem,
ProcessManager: () => processManager,
Cache: () => Cache.test(
processManager: processManager,
),
Logger: () => logger,
});
testUsingContext('force updates packages --synthetic-package-path', () async { testUsingContext('force updates packages --synthetic-package-path', () async {
final UpdatePackagesCommand command = UpdatePackagesCommand(); final UpdatePackagesCommand command = UpdatePackagesCommand();
const String dir = '/path/to/synthetic/package'; const String dir = '/path/to/synthetic/package';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment