mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Run the flutter_tools create test in online mode before testing offline mode (#89779)
Offline pub assumes that the pub cache contains all needed packages. Running "flutter create" in online mode first will ensure that the pub cache is populated. Fixes https://github.com/flutter/flutter/issues/89759
This commit is contained in:
parent
000f4444b8
commit
a14be9d290
@ -1702,13 +1702,20 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext(
|
testUsingContext(
|
||||||
'invokes pub offline when requested',
|
'invokes pub in online and offline modes',
|
||||||
() async {
|
() async {
|
||||||
Cache.flutterRoot = '../..';
|
Cache.flutterRoot = '../..';
|
||||||
|
|
||||||
final CreateCommand command = CreateCommand();
|
final CreateCommand command = CreateCommand();
|
||||||
final CommandRunner<void> runner = createTestCommandRunner(command);
|
final CommandRunner<void> runner = createTestCommandRunner(command);
|
||||||
|
|
||||||
|
// Run pub online first in order to populate the pub cache.
|
||||||
|
await runner.run(<String>['create', '--pub', projectDir.path]);
|
||||||
|
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
|
||||||
|
expect(loggingProcessManager.commands.first, isNot(contains('--offline')));
|
||||||
|
|
||||||
|
// Run pub offline.
|
||||||
|
loggingProcessManager.clear();
|
||||||
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
|
await runner.run(<String>['create', '--pub', '--offline', projectDir.path]);
|
||||||
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
|
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
|
||||||
expect(loggingProcessManager.commands.first, contains('--offline'));
|
expect(loggingProcessManager.commands.first, contains('--offline'));
|
||||||
@ -2820,4 +2827,8 @@ class LoggingProcessManager extends LocalProcessManager {
|
|||||||
mode: mode,
|
mode: mode,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
commands.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user