File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed
test/commands.shard/hermetic Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -498,7 +498,9 @@ class UpdatePackagesCommand extends FlutterCommand {
498498 'Running "flutter pub get" in affected packages...' ,
499499 );
500500 try {
501- final TaskQueue <void > queue = TaskQueue <void >(maxJobs: intArg ('jobs' ));
501+ // int.tryParse will convert an empty string to null
502+ final int /*?*/ maxJobs = int .tryParse (stringArg ('jobs' ) ?? '' );
503+ final TaskQueue <void > queue = TaskQueue <void >(maxJobs: maxJobs);
502504 for (final Directory dir in packages) {
503505 unawaited (queue.add (() async {
504506 final Stopwatch stopwatch = Stopwatch ();
Original file line number Diff line number Diff line change @@ -148,6 +148,30 @@ void main() {
148148 processManager: FakeProcessManager .any (),
149149 ),
150150 });
151+
152+ testUsingContext ('force updates packages --jobs=1' , () async {
153+ final UpdatePackagesCommand command = UpdatePackagesCommand ();
154+ await createTestCommandRunner (command).run (< String > [
155+ 'update-packages' ,
156+ '--force-upgrade' ,
157+ '--jobs=1' ,
158+ ]);
159+ expect (pub.pubGetDirectories, equals (< String > [
160+ '/.tmp_rand0/flutter_update_packages.rand0' ,
161+ '/flutter/examples' ,
162+ '/flutter/packages/flutter' ,
163+ ]));
164+ expect (pub.pubBatchDirectories, equals (< String > [
165+ '/.tmp_rand0/flutter_update_packages.rand0' ,
166+ ]));
167+ }, overrides: < Type , Generator > {
168+ Pub : () => pub,
169+ FileSystem : () => fileSystem,
170+ ProcessManager : () => FakeProcessManager .any (),
171+ Cache : () => Cache .test (
172+ processManager: FakeProcessManager .any (),
173+ ),
174+ });
151175 });
152176}
153177
You can’t perform that action at this time.
0 commit comments