Unverified Commit a14be9d2 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

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
parent 000f4444
......@@ -1702,13 +1702,20 @@ void main() {
});
testUsingContext(
'invokes pub offline when requested',
'invokes pub in online and offline modes',
() async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
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]);
expect(loggingProcessManager.commands.first, contains(matches(r'dart-sdk[\\/]bin[\\/]dart')));
expect(loggingProcessManager.commands.first, contains('--offline'));
......@@ -2820,4 +2827,8 @@ class LoggingProcessManager extends LocalProcessManager {
mode: mode,
);
}
void clear() {
commands.clear();
}
}
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